Skip to content

Conversation

@sourishkrout
Copy link

@sourishkrout sourishkrout commented Nov 18, 2025

This PR "fixes" the button so it will no longer include un-rendered MDX into what's copied as shown in the screenshot below.

It's unclear if the llms.txt should only include plain markdown, too. According to official spec, it's plain markdown. Currently, it does include mdx tags. - I have stopped short of including a fix for llms.txt because it's a larger refactor and wanted to be sure it's welcomed first.

image

Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
function remarkReplaceMdxComponents() {
return (tree: Root) => {
const calloutComponents = ["Note", "Warning", "Info", "Success", "Callout"];
const otherComponents = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fairly brittle. What happens when we add new components?

Copy link
Author

@sourishkrout sourishkrout Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per comments, the AST visitor does 4 passes. Up until 3 it handles them semantically:

  1. Handle TabbedSection components
  2. Handle standalone Tab components (outside TabbedSection)
  3. Handle callout components (Note, Warning, Info, Success, Callout)
  4. Just extract content from any other components that we don't semantically understand (see 677f978)

My suggestion would be to instead error fatally with a descriptive message if 4.) comes across an unknown component. This guards against a generic "text extraction" not covering a new components semantic's appropriately.

Happy to make the change.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there's already a "mdx linter" that runs pre-commit. It'd be low-hanging fruit to extend it to check for new "unknown" mdx components to prevent undefined behavior slipping through the cracks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think something that ensures we don't accidentally not handle something would be good

Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
Signed-off-by: Sebastian (Tiedtke) Huckleberry <[email protected]>
@sourishkrout sourishkrout marked this pull request as draft November 24, 2025 22:43
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.

2 participants