Repository navigation
Fix: skip import/export statements in description extraction - #39
Merged
rachfop merged 1 commit intoApr 20, 2026
Merged
Conversation
When a .mdx file starts with import statements before any content paragraph, the description extraction for llms.txt picks up the import line as the page description instead of actual content. This adds a check to skip paragraphs that start with `import` or `export` statements during description fallback extraction, matching the existing behavior of excludeImports for content cleaning. Fixes rachfop#9 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Owner
|
Taking a look now. Thank you! |
2 tasks done
scottamain
pushed a commit
to scottamain/docusaurus-plugin-llms
that referenced
this pull request
Jul 10, 2026
Adds test coverage for the fix in rachfop#39 that skips import/export statements during description extraction in .mdx files. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
.mdxfiles start withimportstatements before any content paragraph, the description extraction forllms.txtpicks up the import line as the page description:Instead of:
This is because
excludeImportsis applied to the content body after description extraction runs (line ~221), so import lines still get picked up by the fallback description logic (line ~171).Related: #9
Fix
Added a check in the description extraction fallback (second priority) to skip paragraphs starting with
importorexportstatements, consistent with howexcludeImportshandles content cleaning.Testing
Tested against the Vectara docs Docusaurus site (389 pages, ~215 affected
.mdxfiles with imports). Before/after:[Concepts](...): import CodePanel from '@site/src/theme/CodePanel';[Concepts](...): Agents are autonomous systems that understand natural language and use tools[Built-in tools](...): import CodePanel from '@site/src/theme/CodePanel';[Built-in tools](...): Tools provide agents with capabilities to interact with data and external