Search code examples
githubmarkdownreadme

How to link to a bullet point within a section in markdown


I am making a readme file for my GitHub project and need to link to a specific bullet point within a specific section in the readme file. Is this possible?


Solution

  • Not directly in Markdown, but you can use an HTML list and add an id to whatever item you want to link to:

    <ul>
      <li>Foo</li>
      <li id="bar">Bar</li>
    </ul>
    

    Then, you can link to it using that id, e.g.

    [Link to Bar](#bar)
    
    <a href="#bar">Link to Bar</a>
    

    Or from another document:

    [Link to Bar](https://github.com/bj97301/project/blob/main/README.md#bar)