无法在 GitHub 风格的 markdown 中的摘要标签内添加链接

问题描述 投票:0回答:1

考虑到下面的降价代码,我想要做的是从第 3 阶段内容中定位

<summary id="stage-one">Stage 1</summary>
[Link to Stage 1](#stage-one)

这种方法的问题是 VS 代码显示 id stage-one 没有定义

<details>

  <summary id="stage-one">Stage 1</summary>

  * Vegetables

  * Fruits

  * Fish

</details>

 
<details>

  <summary id="stage-two">Stage 2</summary>

  * Vegetables

  * Fruits

  * Fish

</details>


<details>

  <summary id="stage-three">Stage 3</summary>

  * Vegetables

  * Fruits

  * Fish

  * [Link to Stage 1](#stage-one)

</details>

尝试使用锚标记

<a href="#stage-one">**Stage 1**</a>
而不是
[Link to Stage 1](#stage-one)
,但遇到了同样的问题。

有没有办法用markdown语言实现这种方式?

html github markdown github-flavored-markdown readme
1个回答
0
投票

我相信这是有效的。但是,您的示例生成的页面太小而无法感知结果。在

id="stage-one">
[Link to Stage 1](#stage-one)
之间添加足够的页面内容,以便当您单击后者 (
id="stage-one">
) 时,必须将前一个 (
[Link to Stage 1](#stage-one)
) 滚动到视图之外(离开页面)。然后您应该看到它按照您的意愿向上滚动到前者。

© www.soinside.com 2019 - 2024. All rights reserved.