Skip to content

fix(editor): html parsing support for unquoted attributes - #1591

Open
Alexander6060 wants to merge 4 commits into
nextfrom
alex3/rm-16375-support-unquoted-attributes-in-native-html-tags
Open

fix(editor): html parsing support for unquoted attributes#1591
Alexander6060 wants to merge 4 commits into
nextfrom
alex3/rm-16375-support-unquoted-attributes-in-native-html-tags

Conversation

@Alexander6060

@Alexander6060 Alexander6060 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor
🎫 Resolve RM-16375

🎯 What does this PR do?

  • Fixes RM-16375 by supporting valid unquoted attribute values on native HTML tags in MDXish, such as <a href=https://example.com>.
  • Prevents URL values from being split into text and autolink nodes.
  • Adds focused regression coverage for MDXish and legacy RMDX parity, tokenizer behavior, and relevant edge cases.

🧪 QA tips

  • In an MDXish page, add <a href=https://example.com>Example</a> and confirm it renders as a link to https://example.com.
  • Confirm unquoted class values work on inline and block tags, such as <span class=example> and <div class=example>.
  • Confirm quoted attributes and existing MDX component attributes continue to render normally.

📸 Screenshot

Before After
View
before-view
View
after-view
Edit
before-edit
Edit
after-edit

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d2612737-d4f4-476f-885c-9cf3aa3439bb

📥 Commits

Reviewing files that changed from the base of the PR and between 09cf149 and 64b3ac0.

📒 Files selected for processing (3)
  • __tests__/lib/mdxish/utils/mdxish-component-tag-parser.test.ts
  • __tests__/lib/micromark/mdx-component.test.ts
  • lib/micromark/mdx-component/syntax.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • readmeio/ai (manual)
  • readmeio/gitto (manual)
  • readmeio/markdown (manual)
  • readmeio/readme (manual)
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/lib/micromark/mdx-component.test.ts
  • lib/micromark/mdx-component/syntax.ts

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.


Walkthrough

Lowercase MDX components now support qualifying unquoted HTML attribute values. The tokenizer tracks pending values, validates delimiters and incomplete assignments, handles self-closing tags, and applies flow-specific claim rules. Inline lowercase tags can complete after their opening tags. Tests cover MDXish, legacy RMDX, flow and inline tags, malformed assignments, nesting, formatting, and parsed output.

Merge Risk: ⚪ Minimal · up to 64b3a

This change adds support for valid unquoted HTML attribute values while preserving existing parsing behavior through focused regression coverage; no actionable merge-blocking risk remains beyond normal checks and review.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

__tests__/lib/mdxish/utils/mdxish-component-tag-parser.test.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: Error while loading rule '@vitest/unbound-method': You have used a rule which requires type information, but don't have parserOptions set to generate type information for this file. See https://tseslint.com/typed-linting for enabling linting with type information.
Parser: /node_modules/@typescript-eslint/parser/dist/index.js
Occurred while linting /tests/lib/mdxish/utils/mdxish-component-tag-parser.test.ts
at throwError (/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js:40:11)
at getParserServices (/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js:29:9)
at create (/node_modules/@typescript-eslint/eslint-plugin/dist/rules/unbound-method.js:138:55)
at Object.create (/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js:39:20)
at create (/node_modules/@vitest/eslint-plugin/dist/index.cjs:6355:35)
at Object.create (/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js:39:20)
at createRuleListeners (/node_modules/eslint/lib/linter/linter.js:895:21)
at /node_modules/eslint/lib/linter/linter.js:1066:110
at Array.forEach ()
at runRules (/node_modules/eslint/lib/linter/linter.js:1003:34)

__tests__/lib/micromark/mdx-component.test.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: Error while loading rule '@vitest/unbound-method': You have used a rule which requires type information, but don't have parserOptions set to generate type information for this file. See https://tseslint.com/typed-linting for enabling linting with type information.
Parser: /node_modules/@typescript-eslint/parser/dist/index.js
Occurred while linting /tests/lib/micromark/mdx-component.test.ts
at throwError (/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js:40:11)
at getParserServices (/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js:29:9)
at create (/node_modules/@typescript-eslint/eslint-plugin/dist/rules/unbound-method.js:138:55)
at Object.create (/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js:39:20)
at create (/node_modules/@vitest/eslint-plugin/dist/index.cjs:6355:35)
at Object.create (/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js:39:20)
at createRuleListeners (/node_modules/eslint/lib/linter/linter.js:895:21)
at /node_modules/eslint/lib/linter/linter.js:1066:110
at Array.forEach ()
at runRules (/node_modules/eslint/lib/linter/linter.js:1003:34)


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@__tests__/lib/mdxish/utils/mdxish-component-tag-parser.test.ts`:
- Around line 456-471: Add direct parser-level assertions for unquoted
attributes that verify both flow and text AST output, rather than only the final
MDXish HAST; apply equivalent coverage to the RMDX engine. Extend the regression
cases for RM-16375 to cover malformed assignments, self-closing tags, whitespace
and line-ending variants, forbidden value delimiters, emphasis variants,
escapes, nesting, blank lines, and formatting differences, naming or labeling
the cases with RM-16375.

In `@lib/micromark/mdx-component/syntax.ts`:
- Around line 96-98: Update the comment near inUnquotedAttr to remove the claim
that CommonMark disallows `/` in unquoted HTML attribute values, while retaining
the accurate explanation about lowercase tags, JSX attribute expressions, and
URL handling.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4c025720-d46d-4c10-9ee9-7ca581ad1e95

📥 Commits

Reviewing files that changed from the base of the PR and between feed88f and 307c29e.

📒 Files selected for processing (2)
  • __tests__/lib/mdxish/utils/mdxish-component-tag-parser.test.ts
  • lib/micromark/mdx-component/syntax.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • readmeio/ai (manual)
  • readmeio/gitto (manual)
  • readmeio/markdown (manual)
  • readmeio/readme (manual)

Comment thread __tests__/lib/mdxish/utils/mdxish-component-tag-parser.test.ts Outdated
Comment thread lib/micromark/mdx-component/syntax.ts Outdated

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@__tests__/lib/mdxish/utils/mdxish-component-tag-parser.test.ts`:
- Around line 458-476: The RM-16375 regression matrix is incomplete for emphasis
variants, escaped opening tags, nesting, blank lines, whitespace, and formatting
differences. In
__tests__/lib/mdxish/utils/mdxish-component-tag-parser.test.ts:458-476, extend
the shared describe.each coverage so every required edge case has explicit
expected output for both MDXish and legacy RMDX. In
__tests__/lib/micromark/mdx-component.test.ts:28-74, add matching assertions for
claim and MDAST behavior in both flow and text contexts, including all required
edge cases.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e33c464e-0b5a-458d-95e3-7b891a65d091

📥 Commits

Reviewing files that changed from the base of the PR and between 307c29e and defe477.

📒 Files selected for processing (3)
  • __tests__/lib/mdxish/utils/mdxish-component-tag-parser.test.ts
  • __tests__/lib/micromark/mdx-component.test.ts
  • lib/micromark/mdx-component/syntax.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • readmeio/ai (manual)
  • readmeio/gitto (manual)
  • readmeio/markdown (manual)
  • readmeio/readme (manual)
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/micromark/mdx-component/syntax.ts

Comment thread __tests__/lib/mdxish/utils/mdxish-component-tag-parser.test.ts

@eaglethrost eaglethrost 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.

Approach & testing looks good! But found some regression cases because of the extended rule:

  1. These cases now swallow the <> parts: "Pass <key=value> to the CLI.", "Compare <a = b> and <c = d>."
  2. PascalCase components with =, ", ', or in an unquoted value drop out of the parser (e.g.<Image src=https://example.com/a.png?w=1 align=center />` would now split out the src as an autolink breaking the component
  3. In this example, the 2 lines no longer are wrapped in paragraphs:
<div id=a>

para one

para two

</div>
Screenshot 2026-08-17 at 2 32 29 pm

@Alexander6060

Copy link
Copy Markdown
Contributor Author

Approach & testing looks good! But found some regression cases because of the extended rule:

  1. These cases now swallow the <> parts: "Pass <key=value> to the CLI.", "Compare <a = b> and <c = d>."
  2. PascalCase components with =, ", ', or in an unquoted value drop out of the parser (e.g.<Image src=https://example.com/a.png?w=1 align=center />` would now split out the src as an autolink breaking the component
  3. In this example, the 2 lines no longer are wrapped in paragraphs:
<div id=a>

para one

para two

</div>
Screenshot 2026-08-17 at 2 32 29 pm

Good catch, implemented here

Here are some screenshots:
image
image

@greptile-apps

greptile-apps Bot commented Aug 17, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

The PR appears safe to merge with no concrete blocking or non-blocking defects identified.

The tokenizer’s new claim conditions align with the intended native HTML scope, preserve malformed and prose-like fallback behavior, and are covered across tokenizer and downstream parsing paths.

Reviews (1): Last reviewed commit: "fix: address feedback regression + tests" | Re-trigger Greptile

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