Skip to content

TOC alignment issue with macros (which contain links) and typeset #5590

@Vasperous

Description

@Vasperous

Context

I have been really looking forward to using the typeset plugin with my documentation as many of my headers are referring to code or objects. Showing them in the TOC as <code> makes it much easier to read.

Bug description

When enabling macros and typeset the TOC seems to not correctly align, specifically when the header is set to be bold and the macros replacement text is a URL.

While putting together this description I started deleting items like extensions etc. in my mkdocs.yml file. I saw various changes in the rendering of what I outlined below. My 'issue' went away when I removed the toc_depth option from the toc extension. I am not sure if that is a bug with the TOC extension or with the way macros/URLs are being handled. Could use some direction on that and since I am not sure I left my bug report as is.

In my .md file I have the following:

### {{rq_host}}

The host object that is not bold.

### **{{rq_host}}**

The host object that is bold...

### **{{rq_test}}**

This is a test of the macros with a non-link/url feature

If I only include the ### {{rq_host}} which is a URL but not bold then everything is displayed without issue:

image

If we only include ### **{{rq_test}}** which is just plain text and bold then everything is displayed without issue:

image

Only when we use the combination of a link and the bold do we see an issue with the TOC alignment ### **{{rq_host}}**:

image

Note: it looks like the whole page is also bold (in previous examples it was not).

For reference, contents of the external yaml file used by macros:

rq_host: "[`host`](#test)"
rq_test: "Test information"

I tried reducing down the number of features in my mkdocs.yml and after deleting all of the content and navigation features I got the below which is what I am seeing in my other documentation (it was at this moment that I started playing around with the extensions and added the second paragraph at the top):

image

Related links

Reproduction

example.zip

The example.zip didn't include the external macros folder so I unzipped it, added it and then re-zipped the files.

Steps to reproduce

  1. Create site
  2. Use macros, typeset and toc features/plugins
  3. Create macros page which references a URL
  4. include the macros link in the documentation and make the text bold
  5. Build documentation

Browser

Other

Before submitting

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue reports a bugresolvedIssue is resolved, yet unreleased if open

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions