Skip to content

x/pkgsite: inconsistent ID remapping with headers as HTML links #54051

@ainar-g

Description

@ainar-g

What is the URL of the page with the issue?

(Self-hosted.)

What is your user agent?

(Any; the issue is with the Markdown renderer.)

Screenshot

Screenshot 2022-07-25

(Personal information removed.)

What did you do?

  1. Init an empty Go module.

  2. Add a readme with the following content:

     #  Test
    
    ##  Table Of Contents
    
     *  [Section](#my-section-id)
         *  [Subsection](#my-subsection-id)
    
    ##  <a href="#my-section-id" id="my-section-id">Section</a>
    
       ###  <a href="#my-subsection-id" id="my-subsection-id">Subsection</a>
  3. Launch pkgsite, navigate to the page of the module, and expand the documentation.

What did you expect to see?

Either HTML IDs being remapped in both the ToC and the headers or no remapping at all.

What did you see instead?

The ToC links are remapped to #readme-my-section-id and #readme-my-subsection-id respectively, while the IDs in headers stay the same, which makes the table of contents links useless.

Additional notes

The ultimate goal is to have a Markdown file with a table of contents and clickable headers that has the same interactive functionality in all Markdown renderers that matter. Which includes most Git hosting sites as well as pkg.go.dev. The former all work, but the latter has HTML ID issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.pkgsitepkgsite/frontendIssues related to pkgsite HTML/CSS/JavaScript and frontend development

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions