Skip to content

fix: skip non-prose blocks when extracting a description - #76

Merged
rachfop merged 1 commit into
rachfop:mainfrom
trofim24:fix/description-non-prose-blocks
Oct 2, 2026
Merged

rachfop merged 1 commit into
rachfop:mainfrom
trofim24:fix/description-non-prose-blocks

Conversation

@trofim24

Copy link
Copy Markdown
Contributor

Fixes #75.

With no frontmatter description, the fallback took the first paragraph that was not a heading and not an import/export, so anything else sitting under the H1 became the page description: an ```mdx-code-block wrapper, a :::note admonition, a table row from a generated API page, a bare JSX element, a standalone image. The unbalanced fence and the leading pipe also break the markdown of the TOC line they land in, and two of these trip the extractor's own warnings ("very long", "contains HTML tags") — it warned about descriptions it had produced itself, then shipped them.

split('\n\n') is also not a paragraph split: a fence containing a blank line was cut in half, so a fragment of a code sample could be picked as the paragraph. Description extraction was the one content transform not using maskCodeSegments; extractTitle masks for exactly this reason.

Mask fences before splitting and restore each candidate before testing it, so a paragraph that merely starts with an inline code span still counts as prose, and skip block starts that are structure rather than prose. Extracting from cleanMarkdownContent output instead would drop the JSX rule, but it fixes no additional page, promotes a label to a description on a page with no prose, and would make descriptions vary with excludeImports / preserveComponents / removeDuplicateHeadings.

With no frontmatter description, the fallback took the first paragraph
that was not a heading and not an import/export, so anything else sitting
under the H1 became the page description: an ```mdx-code-block wrapper, a
:::note admonition, a table row from a generated API page, a bare JSX
element, a standalone image. The unbalanced fence and the leading pipe
also break the markdown of the TOC line they land in, and two of these
trip the extractor's own warnings ("very long", "contains HTML tags") —
it warned about descriptions it had produced itself, then shipped them.

split('\n\n') is also not a paragraph split: a fence containing a blank
line was cut in half, so a fragment of a code sample could be picked as
the paragraph. Description extraction was the one content transform not
using maskCodeSegments; extractTitle masks for exactly this reason.

Mask fences before splitting and restore each candidate before testing
it, so a paragraph that merely starts with an inline code span still
counts as prose, and skip block starts that are structure rather than
prose. Extracting from cleanMarkdownContent output instead would drop the
JSX rule, but it fixes no additional page, promotes a <TabItem> label to
a description on a page with no prose, and would make descriptions vary
with excludeImports / preserveComponents / removeDuplicateHeadings.
@rachfop
rachfop force-pushed the fix/description-non-prose-blocks branch from cddd33e to c231cad Compare October 2, 2026 19:53
@rachfop
rachfop merged commit c7e4241 into rachfop:main Oct 2, 2026
3 checks passed
rachfop added a commit that referenced this pull request Oct 2, 2026
Fix factual errors found by checking every documented claim against src/:

- Default llms.txt links have no .md suffix: addMdExtension applies only
  with generateMarkdownFiles.
- customLLMFiles[].includeUnmatchedLast defaults to true.
- Any .md/.mdx import is inlined, @alias/ paths resolve against the site
  directory, and a circular import is an error that drops the import.
- processingBatchSize sets progress-logging granularity; documents are
  all processed before batching, so it doesn't bound memory.
- pathTransformation addPaths inserts after the route base path; the
  examples now use site-relative paths with docsDir: 'docs'.
- Section headings need two or more sections and fall back to path;
  routeBasePath and blogRouteBasePath are relative to baseUrl.
- Root-URL pages map to index.md; sample log output matches the real
  output; remove the llmsTxtFilename "keep both links" example, which
  doesn't work.

Document behavior that had no docs: how titles and descriptions are
chosen (including the #76 skips), directory index handling (#74), the
llms-full.txt page structure, draft skipping, and the auto-mode
"Version: current" label.

Replace the duplicated DocsSection and CustomLLMFile tables in
content-generation.md with links to the configuration reference, merge
the two overlapping cleaning-combination sections, and drop text that
narrated history (the backward-compatibility section, "existing configs
are unaffected" caveats).

Give every page a front matter description and order the site's
llms.txt by the sidebar, so the dogfood llms.txt has full summaries in
reading order. Add a Documentation entry to the Unreleased changelog.

Co-authored-by: Claude Opus 5.5 <[email protected]>
rachfop added a commit that referenced this pull request Oct 2, 2026
Fix factual errors found by checking every documented claim against src/:

- Default llms.txt links have no .md suffix: addMdExtension applies only
  with generateMarkdownFiles.
- customLLMFiles[].includeUnmatchedLast defaults to true.
- Any .md/.mdx import is inlined, @alias/ paths resolve against the site
  directory, and a circular import is an error that drops the import.
- processingBatchSize sets progress-logging granularity; documents are
  all processed before batching, so it doesn't bound memory.
- pathTransformation addPaths inserts after the route base path; the
  examples now use site-relative paths with docsDir: 'docs'.
- Section headings need two or more sections and fall back to path;
  routeBasePath and blogRouteBasePath are relative to baseUrl.
- Root-URL pages map to index.md; sample log output matches the real
  output; remove the llmsTxtFilename "keep both links" example, which
  doesn't work.

Document behavior that had no docs: how titles and descriptions are
chosen (including the #76 skips), directory index handling (#74), the
llms-full.txt page structure, draft skipping, and the auto-mode
"Version: current" label.

Replace the duplicated DocsSection and CustomLLMFile tables in
content-generation.md with links to the configuration reference, merge
the two overlapping cleaning-combination sections, and drop text that
narrated history (the backward-compatibility section, "existing configs
are unaffected" caveats).

Give every page a front matter description and order the site's
llms.txt by the sidebar, so the dogfood llms.txt has full summaries in
reading order. Add a Documentation entry to the Unreleased changelog.
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.

Description extraction picks up code fences, tables, admonitions and JSX

2 participants