Skip to content

v0.3.0

Latest

Choose a tag to compare

@dvejsada dvejsada released this 29 Sep 20:35
9864ad8

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. Use item_text, render_item, list_items.
  • New block kinds: heading (in items/quotes, with Block.level; #81), source (written as-is; #82), html (raw HTML block; #49).
  • Paragraph text holds \n between lines (#87); a line ending in \ or two spaces is a hard break.
  • document_to_dict changed shape: items are {"blocks": [...]}, blocks gain align/level. Migrate stored dicts, or read them back with document_from_dict.
  • Tables follow GFM (#77): empty cells/rows kept, Block.align per 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): lex block_fragments(block) output.
  • Diagnostic gains line and file (#85): compare fields, not whole objects.
  • FrontmatterError for unreadable frontmatter (#73), with .line; scalar/list frontmatter is now body with frontmatter-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 has line.

New

  • Assembly (§15.7, #55): assemble(), template_questions(), needed_questions(), legaldown assemble; answer rules answer-*.
  • 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 in legaldown.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.