Skip to content

Release v0.0.20

Choose a tag to compare

@github-actions github-actions released this 22 Oct 12:33

Patch release v0.0.20

Changes

Yo v0.2.69 compatibility: decision 47 mut, explicit copies; fix CRLF/NUL normalized-offset over-read and a duplicate-footnote hang (#21)

  • refactor: take BlockState's cached element pointers before the lists move in

The six ArrayList locals move into the struct and the struct also caches
.ptr() of each one. Reading the pointers before the moves makes the move
the last use of every list, so Yo's explicit-copy migration (VBD V2b) leaves
each a move instead of inserting a .clone() whose buffer the cached
pointer would not point into. A move keeps the heap buffer, so the pointers
are the same values as before.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

  • feat: mark the written local bindings mut(...) (Yo decision 47, locals)

yo fix ./src ./tests ./build.yo --migrate mut-bindings (Yo 0.2.67 tree
compiler): 577 bindings marked in 48 files, none left as written, no
parameter writes. Since Yo 0.2.65 a write to a local declared without
mut is E0917 outside the Yo tree and the package store, so this checkout
stopped evaluating under any compiler newer than its 0.2.64 pin (51 of 54
src files failed). The store copy the Yo compiler imports is exempt until
decision 47's locals Generation B.

.yo-version moves to 0.2.67: 0.2.64 does not parse a local mut(x).

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

  • feat: spell the ArrayList/String copies explicitly (Yo VBD V2b B2)

yo fix ./src --migrate explicit-copy (Yo 0.2.67 tree compiler, the
fixed-migration branch): two .clone() insertions in inline/link.yo (the
resolved reference's href and title). It listed eight sites to decide by
hand:

  • block/state.yo (2): BlockState.src held a share of the caller's bytes.
    The normalized-source builder now takes the normalized list BY VALUE, so
    the state owns it by a move (the cached src_ptr stays valid); the fast
    path stores an empty list, because src_ptr points into the caller's
    bytes, which markdown_to_html keeps in a local that outlives the state.
    No copy of the source on either path.
  • normalize.yo (2): normalize returns a borrowed String, so the
    unchanged-input paths return src.clone().
  • renderer.yo finish: takes the renderer by value, so the output buffer
    moves into the result String instead of being copied (its one caller is
    the tail of markdown_to_html). The tool still lists self.buf there
    because self is written later in the module; a move is what it is.
  • renderer.yo open_image/open_image_buf: the title kept until
    close_image is title.clone(); close_image escapes img_title
    in place instead of copying it out.

A re-run of the migration lists only the finish site and inserts nothing.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

  • docs: the library example marks its written local mut and lends with &; conventions note mut(...) and .clone()

The README example stopped compiling under Yo 0.2.65+: opts.html = true
writes an unmarked local (E0917), and markdown_to_html / println take
their arguments as & borrows (E0914). Checked with the Yo 0.2.67 tree
compiler.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

  • fix: an abbreviation definition line is no longer read at offset -1 (heap over-read on line 0)

The abbreviation prescan marked each consumed definition line by setting its
first-non-space offset to -1, and block_abbr ran seventh in the dispatch, so
the table/fence/... rules read the byte at bm - 1 first: one byte before the
source buffer when the definition is line 0 (ASan: heap-buffer-overflow;
19/23 abbr and 4/4 abbr_typographer fixtures failed under an ASan binary),
and the previous newline elsewhere, which let a definition interrupting a
paragraph or following a list item render inside it.

The mark is now a per-line flag bit, block_abbr runs first, and the block
terminator check consults it (markdown-it-abbr's abbr_def has alt paragraph
and reference). issues/abbreviation-definition-lines-are-read-at-offset-minus-one.md;
regression test in tests/main.test.yo (red before under both Yo 0.2.67 and
the tree compiler). The prescan's missing block context stays open:
issues/abbreviation-prescan-ignores-block-context.md.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

  • chore: version 0.0.20 in yo.toml

Not tagged. npm/package.json stays 0.0.19 on purpose: the Release
workflow's patch bump computes the new version from it (0.0.19 -> 0.0.20)
and rewrites yo.toml to match, so a hand-bumped npm version would release
0.0.21.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

  • fix: HtmlRenderer.finish moves its buffer out by destructuring; parser.yo's lifetime comment names src_bytes

finish took self by value but read self.buf, a field read, which the
explicit-copy analysis counts as a copy (Yo has no partial moves,
VALUES_BY_DEFAULT decision 19), so it was not the move 93a32cd's comment
claimed and would turn into E0901 at the V2b B8 flip. It now destructures
the renderer as a whole value: match(self, { buf } => String.from_bytes(buf)).
yo fix --migrate explicit-copy --dry-run (tree compiler) lists no site in
src any more.

parser.yo still said state keeps the source bytes alive; since 93a32cd
the fast path stores an empty list there, and it is the src_bytes local,
declared before state, that does.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

  • fix: the renderer reads the normalized source, not the caller's bytes (CRLF mis-render, NUL heap over-read)

markdown_to_html created the HtmlRenderer over the caller's bytes and never
re-pointed it when BlockState normalized the source (\r\n and \r to \n,
\0 to U+FFFD) into a copy, so the renderer read the caller's bytes at the
copy's offsets: a CRLF indented code block printed shifted text, CRLF
footnote and abbreviation definitions were looked up in the wrong bytes, and
NUL input (one byte that becomes three) read past the end of the caller's
buffer (ASan heap-buffer-overflow with --abbr or --footnote, or in an
indented code block). yo doc enables both footnotes and abbreviations.
v0.0.19 shows the same.

HtmlRenderer.set_source points src_ptr, src_len and _orig_src at the
normalized buffer; _build_block_state_from_normalized calls it before the
block pass. issues/the-renderer-reads-the-caller-bytes-at-normalized-offsets.md;
regression test in tests/main.test.yo, red before the fix under Yo 0.2.67,
0.2.68 and the tree compiler.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

  • docs(issues): the abbreviation prescan also registers definitions on lazy continuation lines and table rows

Two more contexts where the prescan registers a definition that markdown-it
does not, and the line also still renders as text: a blockquote's lazy
continuation line and a table body row. The Direction section now covers a
definition counting only where a block may start.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

  • fix: a repeated footnote label no longer loops the block pass forever

The block pass skipped a footnote definition's lines by looking it up BY
LABEL (fn_find_def, first match) and jumping to its line_end. At the second
definition of a label that found the first one, whose end lies before the
current line, so the parse jumped back and never finished, emitting the text
between them each time (10 GB resident under ASan on the footnote fixture
file before it was killed). yo doc enables footnotes. v0.0.19 shows the same.

Rule 7b now finds the definition registered at the current line
(HtmlRenderer.fn_def_at_line), and fn_find_def returns the label's LAST
definition, the content markdown-it-footnote uses.
issues/a-repeated-footnote-label-never-finishes-parsing.md; regression test
in tests/main.test.yo (before the fix its test binary loops until a 120 s
watchdog kills it, under Yo 0.2.67, 0.2.68 and the tree compiler). Filed
open: issues/footnote-definitions-nested-in-a-container-are-not-registered.md.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com


Co-authored-by: Claude Opus 5.5 noreply@anthropic.com

Downloads

Platform File
macOS (Apple Silicon) markdown_yo-macos-arm64.tar.gz
macOS (Intel) markdown_yo-macos-x86_64.tar.gz
Linux (x86_64) markdown_yo-linux-x86_64.tar.gz
Windows (x86_64) markdown_yo-windows-x86_64.zip
WebAssembly markdown_yo-wasm.tar.gz

npm

npm install markdown_yo@0.0.20