Skip to content

fix: handle malformed JSX tags with quotes in invalid positions#50

Open
hkdeman wants to merge 1 commit intomainfrom
claude/issue-49-20250723-1112
Open

fix: handle malformed JSX tags with quotes in invalid positions#50
hkdeman wants to merge 1 commit intomainfrom
claude/issue-49-20250723-1112

Conversation

@hkdeman
Copy link
Contributor

@hkdeman hkdeman commented Jul 23, 2025

Fixes issue #49 where single quotes inside malformed JSX attributes would cause MDX parsing errors.

The preprocessMdxTags function now detects and escapes such malformed tags by wrapping them in backticks to treat them as literal text.

Example: <AccordionNo Documents'"> becomes properly escaped text

Generated with Claude Code

Fixes issue where single quotes inside malformed JSX attributes
would cause MDX parsing errors. The preprocessMdxTags function
now detects and escapes such malformed tags by wrapping them
in backticks to treat them as literal text.

Example: <AccordionNo Documents''> becomes backtick wrapped text

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: H <hkdeman@users.noreply.github.com>
@jazzberry-ai
Copy link

jazzberry-ai bot commented Jul 23, 2025

Bug Report

Name|Severity|Example test case|Description\n---|---|---|---\nIncorrect handling of escaped backticks inside code blocks|Medium|```\n<Component \`attr\`>\n```|The isInsideCodeBlock function only counts the occurrences of ```. If a code block contains an escaped backtick (\`\`), the function will miscalculate whether the current position is inside a code block. In the example above, the malformed tag <Component \`attr\`> will be incorrectly identified as not being inside a code block. This will lead the regex to incorrectly escape the tag, resulting in double escaping (\`\`<Component \`attr\`>\`\`).

Comments? Email us.

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