Skip to content

Support explicit heading IDs #1608

Closed
Closed
@tesseralis

Description

@tesseralis

We currently auto-generate IDs for headings and often link to those generated IDs. As pointed out by @smikitky, this causes issues with translation (see #1605). If article sections are translated (which they should), the generated IDs will be inconsistent with the English ones, which means translators will need to search for links to those sections and change them correspondingly.

There are two steps needed for this:

First, adding support for custom heading IDs in the markdown parser (I checked, we don't support the syntax right now). While this isn't strictly necessary, it would be a great aid for translators and prevent them from having to write ugly html (<h2 id="examples">Amplesexay</h2>).

Second, create a script and node task to add explicit IDs to all headings, and a test/lint to make sure that all headings have an explicit heading. The task allows English documentation writers to not worry about creating IDs whenever they write new blog posts/documentation. The test helps ensure that IDs are consistent among the English and international versions of the documentation.

We also may want to consider things like warning when generated IDs are too long (#what-do-hooks-mean-for-popular-apis-like-redux-connect-and-react-router), or allowing headings in code blocks (## `Context.Provider` ) to not have an explicit heading, since those should not be translated anyway.

Metadata

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