Skip to content

Ignore extra characters in the "preamble" of a Fenced Code Block after the Language #2426

@vorburger

Description

@vorburger

Following-up to squidfunk/mkdocs-material#5473, I now better understand that the "upstream" which that issue has referred me to is this project.

It seems pygments does not like extra characters in the "preamble" of a Fenced Code Block, after the Language. An example of what I mean is e.g. the ```bash $? cd .././.././.. on this MD with this raw src. (I have a particular reason for wanting this to work like on GitHub in pygments <- mkdocs <- mkdocs-material <- enola - I'm "sneaking in" some (hidden) additional metadata in my "Executable Markdown" processor after the language - see https://docs.enola.dev/use/execmd!)

This seems to break language detection (what follows is not bash syntax highlighted), and worse are even formatted as one long continous line of preformatted text without line breaks.

GitHub's MD renderer seems to only look at the first word after the 3 ticks, so e.g. ```bash WHATEVER` works, as it ignores the rest.

Could pygments be easily made to ignore anything after the first word after the 3 ticks in a Fenced Code Block?

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