Unable to add a link inside the summary tag in GitHub flavored markdown

52 Views Asked by At

Considering the below markdown code, what I would like to do is target the <summary id="stage-one">Stage 1</summary> from inside the Stage 3 content as such [Link to Stage 1](#stage-one).

The issue with this approach is that VS code says No definition for the 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>

Tried using the anchor tag <a href="#stage-one">**Stage 1**</a> instead of [Link to Stage 1](#stage-one) but faced the same issue.

Is there a way to implement this approach in markdown language?

1

There are 1 best solutions below

0
On

I believe this is working. However, your example yields a page too small to perceive the result. Add sufficient page content between id="stage-one"> and your [Link to Stage 1](#stage-one) so that you have to scroll the former (id="stage-one">) out-of-view (off the page) when you click on the later ([Link to Stage 1](#stage-one)). Then you should see that it scrolls up to the former, as you desire.