Skip to content

fix: mask empty and unclosed fences, keep require() images, rewrite @site images - #92

Merged
rachfop merged 1 commit into
mainfrom
fix/content-edge-cases
Oct 3, 2026
Merged

rachfop merged 1 commit into
mainfrom
fix/content-edge-cases

Conversation

@rachfop

@rachfop rachfop commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Remaining content-cleaning edge cases:

  • Empty fenced blocks and unclosed fences weren't masked, so cleaning could alter their content. An unclosed fence now runs to the end of its container, as in CommonMark.
  • <img src={require('./x.png').default}> and other literal src expressions were dropped; they become Markdown images, which rewriteImageUrls then rewrites.
  • @site/ image paths weren't rewritten. They resolve against the site directory like a relative image, matching Docusaurus's image handling.
  • A multi-line front matter description whose first line opened a code span or link left it open in llms.txt.

tests/test-content-edge-cases.js covers each case (21 of 29 checks fail on main). The docs site output is unchanged. On a 3,461-page docs site, the only difference is require() images appearing as Markdown images, with no words lost.

…site images

- maskCodeSegments masks an empty fenced block, and an unclosed fence from
  its opener to the end of its container (document, list item, or
  blockquote), so cleaning and partial resolution leave its content as
  written.
- <img src={require('./x.png').default}> and literal brace src values
  become markdown images.
- rewriteImageUrls resolves @site/ image paths against the site directory
  like a relative image; one with no bundled asset that the build serves
  from a static directory is rewritten to its static URL.
- A front matter description whose first line leaves a code span or link
  open drops the dangling opener in llms.txt and ends with '...'.
@rachfop
rachfop merged commit 7aa7812 into main Oct 3, 2026
5 checks passed
@rachfop
rachfop deleted the fix/content-edge-cases branch October 3, 2026 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant