Skip to content

fix: escape HTML to fix llms.txt files#266

Open
ssbushi wants to merge 2 commits into
mainfrom
sb/fixLlms
Open

fix: escape HTML to fix llms.txt files#266
ssbushi wants to merge 2 commits into
mainfrom
sb/fixLlms

Conversation

@ssbushi

@ssbushi ssbushi commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request converts HTML links to Markdown in the documentation and introduces HTML escaping for generated llms.txt files. A critical issue was identified where merge conflict markers were accidentally committed to dotprompt.mdx, which must be resolved. Additionally, the implementation of escapeHtml in src/generate-llms-direct.ts is problematic as it escapes characters within code snippets, potentially hindering LLM readability; it is recommended to handle HTML tags during content processing instead.

Comment thread src/content/docs/docs/dotprompt.mdx Outdated
Comment on lines +294 to +296
function escapeHtml(text: string): string {
return text.replace(/</g, '&lt;').replace(/>/g, '&gt;');
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The escapeHtml function performs a global replacement of < and >. This will escape these characters even when they are part of valid code snippets (e.g., if (x < y) becomes if (x &lt; y)), which is generally undesirable for llms.txt files intended for LLM consumption. LLMs typically process Markdown and raw code better than HTML entities.

If the goal is to ensure the output doesn't contain raw HTML tags, it is better to convert those tags to Markdown in the source files (as seen in your changes to dotprompt.mdx) or use a more targeted approach to strip HTML tags during the content processing phase in src/utils/content-processor.ts.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a stopgap for now.

@ssbushi ssbushi requested review from i14h and pavelgj April 23, 2026 01:37

@i14h i14h left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm not sure if we should make these changes only for Antigravity. Other code agents seem to be working fine. Lets hold back for now

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.

3 participants