Markdown link reference comments render as visible text in docs
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- markdown, typescript
- 领域
- documentation, tooling
调研方向
首先定位 @tanstack/markdown 中对链接引用定义的处理,并使用受影响的 TanStack Query 文档页面复现该问题。确认带有目标和标题的定义会从渲染输出中省略,包括 [//]: # 'SomeLabel' 这种形式,同时普通的链接引用仍能正确渲染。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
Markdown comments written as link reference definitions with titles are rendering as visible text on the TanStack docs site.
For example, comments like this:
[//]: # 'SomeLabel'
appear visibly in the rendered docs page, but they are correctly hidden when previewing the same Markdown file on GitHub.
Affected scope
Any docs page generated from Markdown files that contain link reference comments with titles, for example:
https://tanstack.com/query/latest/docs/framework/react/guides/queries
This pattern appears to be used across many docs files, so the issue is not limited to a single page.
Expected behavior
The line should be parsed as a CommonMark link reference definition and omitted from rendered output, matching GitHub's Markdown preview behavior.
Actual behavior
The line is rendered as visible text in the docs page.
Why this matters
This pattern is used throughout the docs as invisible labels/anchors. In TanStack Query docs alone, many files use this syntax, so the issue can show up across multiple docs pages.
Likely root cause
The docs site appears to use @tanstack/markdown for parsing. Its link reference definition handling currently appears to only match definitions where the destination is the final token on the line:
const definition = line.match(/^ {0,3}\[([^\]\n]+)\]:[ \t]*(\S+)[ \t]*$/);
That does not match this valid CommonMark form:
[//]: # 'SomeLabel'
In this case, # is the destination and 'SomeLabel' is the optional title.
Suggested fix
Allow link reference definitions to include an optional title, matching CommonMark behavior:
const definition = line.match(
/^ {0,3}\[([^\]\n]+)\]:[ \t]*(\S+)(?:[ \t]+"[^"]*"|[ \t]+'[^']*'|[ \t]+\([^)]*\))?[ \t]*$/,
);
This would parse the example as a link reference definition and prevent it from being rendered as visible docs text.
- 主要语言
- TypeScript
- 星标
- 1.1k
- 派生
- 401
- 平均合并
- 18 小时 44 分钟
- 30 天内合并 PR
- 55
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TanStack/tanstack.com 的其他 Issue
-
source-audit
难度 1/5 1 小时以内 新手友好度 84/100
TanStack/tanstack.com#1195 ·
-
source-audit
难度 2/5 1-3 小时 新手友好度 68/100
TanStack/tanstack.com#1194 · 2 条评论 ·
-
source-audit
难度 2/5 1-3 小时 新手友好度 72/100
TanStack/tanstack.com#1177 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 64/100
TanStack/tanstack.com#1059 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
TanStack/tanstack.com#1047 ·
查看 TanStack/tanstack.com 的全部 Issue
相似的 Issue
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 1/5 1 小时以内 新手友好度 85/100
-
Mend: dependency security vulnerability untriaged
难度 2/5 1-3 小时 新手友好度 70/100