fix(markdown): parse link reference definitions with titles#1017
fix(markdown): parse link reference definitions with titles#1017gs0428 wants to merge 3 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughA patch for ChangesMarkdown Link Reference Definition Fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/markdown-link-reference-definitions.test.ts (1)
19-40: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert definition extraction, not just output suppression.
These assertions still pass if
extractDefinitionsmerely drops[...]: ...lines. Since this patch changes reference-definition parsing, add a check that a real reference resolves or that the parsed reference table contains the definition as well.🤖 Prompt for 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. In `@tests/markdown-link-reference-definitions.test.ts` around lines 19 - 40, The current test only verifies that reference-definition lines disappear from the rendered output, so it can still pass even if `extractDefinitions` simply strips those lines. Update `markdown-link-reference-definitions.test.ts` to also assert the actual reference parsing behavior by checking that a reference link in `parseSiteMarkdown` resolves correctly or that the parsed definition table on the returned document contains the expected definition entry; use the existing `markdownCases` loop and `parseSiteMarkdown` result to add this validation alongside the current paragraph assertions.
🤖 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 `@patches/`@tanstack__markdown@0.0.5.patch:
- Around line 9-12: The reference-definition parser in the markdown patch now
matches titled links, but the `references` map still only stores `href`, so the
title metadata is lost. Update the logic around `definition` parsing to capture
the optional title from the regex and persist it alongside `href` when assigning
`references[normalizeReferenceLabel(...)]`, keeping the handling in the
reference-definition path consistent with the new pattern.
---
Nitpick comments:
In `@tests/markdown-link-reference-definitions.test.ts`:
- Around line 19-40: The current test only verifies that reference-definition
lines disappear from the rendered output, so it can still pass even if
`extractDefinitions` simply strips those lines. Update
`markdown-link-reference-definitions.test.ts` to also assert the actual
reference parsing behavior by checking that a reference link in
`parseSiteMarkdown` resolves correctly or that the parsed definition table on
the returned document contains the expected definition entry; use the existing
`markdownCases` loop and `parseSiteMarkdown` result to add this validation
alongside the current paragraph assertions.
🪄 Autofix (Beta)
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: defaults
Review profile: CHILL
Plan: Pro
Run ID: bbf7044a-748c-4d41-ba71-fb4fe0050e1f
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
patches/@tanstack__markdown@0.0.5.patchpnpm-workspace.yamltests/markdown-link-reference-definitions.test.ts
There was a problem hiding this comment.
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/markdown-link-reference-definitions.test.ts`:
- Around line 8-24: Add a focused regression case in
markdown-link-reference-definitions.test.ts for the exact comment-style/hash
reference path: use the existing markdown reference parsing setup to exercise
[Example][//] against the [//]: # ... definition and assert the resolved link
has href set to # and the expected title. Update the relevant table-driven cases
near the existing referenceMarkdown/title fixtures so the test specifically
covers the [//] symbol handled by the parser, not just normal example
references.
🪄 Autofix (Beta)
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: defaults
Review profile: CHILL
Plan: Pro
Run ID: aa0cfc1d-71c6-4b2c-9c4e-01b16ecbad4f
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
patches/@tanstack__markdown@0.0.5.patchtests/markdown-link-reference-definitions.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- patches/@tanstack__markdown@0.0.5.patch
Summary
Fixes Markdown link reference definitions with optional titles being rendered as visible text in docs pages.
This affects Markdown comments such as:
These are valid CommonMark link reference definitions where
#is the destination and'SomeLabel'is the optional title, so they should be removed from rendered output.close #1015
Changes
@tanstack/markdown@0.0.5Validation
pnpm testSummary by CodeRabbit
Bug Fixes
Tests
hrefandtitle.