Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Markdown link reference comments render as visible text in docs

未关闭
#1,015 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
markdown, typescript

调研方向

首先定位 @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:

Image

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

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TanStack/tanstack.com 的其他 Issue

查看 TanStack/tanstack.com 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。