The parser now reads CommonMark/GFM blocks as cmark-gfm does, the model keeps what it reads, diagnostics carry lines, and the release adds template assembly and a public API for renderers. Minor release before 1.0: the model and helpers change; read Breaking changes before upgrading. Spec target: LegalDown v0.2.
Breaking changes
- List items are
ListItems holding blocks (#64, #71), not strings; nested lists are blocks inside items. Useitem_text,render_item,list_items. - New block kinds:
heading(in items/quotes, withBlock.level; #81),source(written as-is; #82),html(raw HTML block; #49). - Paragraph
textholds\nbetween lines (#87); a line ending in\or two spaces is a hard break. document_to_dictchanged shape: items are{"blocks": [...]}, blocks gainalign/level. Migrate stored dicts, or read them back withdocument_from_dict.- Tables follow GFM (#77): empty cells/rows kept,
Block.alignper column. - Quote content is read as blocks (#72): code and HTML in quotes hold no directives.
- Section numbers stay unique after a skipped heading level (#50).
lex()no longer blanks fenced code (#87): lexblock_fragments(block)output.Diagnosticgainslineandfile(#85): compare fields, not whole objects.FrontmatterErrorfor unreadable frontmatter (#73), with.line; scalar/list frontmatter is now body withfrontmatter-absent, not an error.- Serializer writes incomplete frontmatter entries and party custom fields (#89), paragraphs as their lines, and new list/table formatting: expect diffs.
empty_document()has no blank representatives. - CLI:
file:line:text output sorted by line; JSON hasline.
New
- Assembly (§15.7, #55):
assemble(),template_questions(),needed_questions(),legaldown assemble; answer rulesanswer-*. - Line numbers in diagnostics (§16.9, #85).
- Public API for renderers (#90):
ValidationResult.is_template,ValidationResult.placed_markers(PlacedMarker),is_template,is_drafting_note,lex,block_fragments/list_fragments(Fragment,ListFragment), condition helpers inlegaldown.validator. The README now defines the public API and its versioning. - Rules:
raw-html(#80),value-curly-quote,frontmatter-absent; 84 of 113 corpus rules. - Directives split across lines are
directive-malformed(#87).
Fixes
CommonMark/GFM fidelity across lists, fences, HTML, tables and blank lines (#49–#77, #86); round trips of nested lists, include_signatures, open fences and frontmatter (#61–#69, #89); a parser hang on an indented table header (#87).
Full notes: see the pull requests linked above.