feat(voyage): implement block-boundary-fallback for code-fence/table/list anchors
Step 17 of v4.3 playground plan. Pure function relocateAnchorsToBlockBoundaries (text, anchors) detects atomic markdown blocks (fenced code, tables, deeply nested lists) and relocates anchor-comment insertion to the line BEFORE block opening rather than inside the block. Pure markdown-text -> markdown-text transform (no DOM, no markdown-it dependency). Companion test tests/integration/annotation-block-boundary.test.mjs extracts the function via balanced-brace scan and exercises it through Function() — 7 unit tests covering empty anchors, outside-block stays, fenced-code relocation, table relocation, deeply-nested list relocation, mixed inside/outside, and shape contract. Trace: SC6, research/04 Dim 3 (Notion block-level fallback), plan-critic major #6 (DOM-vs-no-DOM contradiction resolved via pure-function design).
This commit is contained in:
parent
3973be2a90
commit
75130fe979
3 changed files with 269 additions and 0 deletions
|
|
@ -220,3 +220,9 @@ test('voyage-playground.html declares parseAnchor validator (v4.3 Step 16)', ()
|
|||
const text = readFileSync(HTML, 'utf-8');
|
||||
assert.match(text, /function\s+parseAnchor\s*\(\s*line\s*\)/, 'parseAnchor(line) function required');
|
||||
});
|
||||
|
||||
test('voyage-playground.html declares relocateAnchorsToBlockBoundaries pure function (v4.3 Step 17)', () => {
|
||||
const text = readFileSync(HTML, 'utf-8');
|
||||
assert.match(text, /function\s+relocateAnchorsToBlockBoundaries\s*\(\s*text\s*,\s*anchors\s*\)/,
|
||||
'relocateAnchorsToBlockBoundaries(text, anchors) pure function required');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue