Skip to content

links fail for identifiers wrapped in backticks with pymdownx.inlinehilite enabled #34

@tlambert03

Description

@tlambert03

This took me a while to figure out, and it's possible this is a "won't fix", but curious to hear your thoughts on this issue.

I use a number of autorefs in the following format:

[`some.identifier`][]

I'm not sure if that's officially supported, but it has always worked well for me, making properly hyperlinked text wrapped in <code>. I recently installed mkdocs-gallery which broke this behavior, and I eventually tracked it down to the addition of pymdownx.inlinehilite to the config. So, with the following config, the above autoref will fail:

site_name: My Docs
markdown_extensions:
  - pymdownx.inlinehilite
plugins:
  - mkdocstrings

I tracked that down to this line:

if re.search(r"[/ \x00-\x1f]", identifier):
# Do nothing if the matched reference contains:
# - a space, slash or control character (considered unintended);
# - specifically \x01 is used by Python-Markdown HTML stash when there's inline formatting,
# but references with Markdown formatting are not possible anyway.
return None, m.start(0), end

if pymdownx.inlinehilite is not included in the config, identifier will equal 'some.identifier' at that line, re.search will not match, and the link will be created. If inlinehilight is included though, identifier will look something like '\x02wzxhzdk:1\x03', and the search will hit preventing the link.

Is this something that you can imagine a fix for? Or is the [`some.identifier`][] syntax just not supported?

thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions