Skip to content

inline code in header with mixed header-ids causes hash entry in toc #675

@lucascool12

Description

@lucascool12

Describe the bug

The table of contents of a markdown string when mixed header-ids is true contains an incorrect entry that starts with md5- and then a base 64 hash.

To Reproduce

import markdown2
markdown_extensions = {
  "header-ids": {"mixed": True,},
  "toc": {"depth": 1},
}
print(markdown2.markdown("# `bla`\n\nfdsa", extras=markdown_extensions).toc_html)

This prints:

<ul>
  <li><a href="#bla"><code>bla</code></a></li>
  <li><a href="#bla"><code>md5-37f709a7534c73bf50ab64ed70a78d02</code"></a></li>
</ul>

Expected behavior

Only a single <li> entry in the table of contents' <ul>.

Debug info
Version of library being used:
2.5.4

Any extras being used:
See reproducer.

I have reproduced this on e09fb90.
And tried git bisecting this problem and have found 5506a52 to be the first commit were this bug was introduced.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions