Skip to content

update (right-hand side) TOC template to use custom anchors  #16469

Open
@thaJeztah

Description

We use a custom liquid template to generate the right-hand (in page) TOC. This code currently generates anchor-links based on the headings themselves. For the reference documentation, we started using custom anchors based on the flags that they relate to. For example;

### <a name="tag"></a> Tag an image (-t, --tag)

With those custom anchors, both the "generated" anchor (#-tag-an-image--t---tag) and the custom (#tag) anchors can be used. The custom anchors allow us to have a predictable anchor, even if the heading is rephrased.

We should update the liquid code to understand the custom anchors, so that the TOC uses them, and so that users can bookmark those links without risking them to change if the headings are changed.

❓ Why not us liquid annotations ({: id=custom-anchor } for these?

We need to use the (hacky) <a name=...></a> because those pages are generated from Markdown pages in upstream repositories. We want those pages to be browsable / readable on GitHub, which doesn't support the liquid annotations. The <a id=...> HTML tags work both on GitHub and in HTML generated by Jekyll (although Jekyll itself doesn't know about them).

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions