Skip to content

Suppress highlight.js's auto guessing the language #59

@mnlipp

Description

@mnlipp

highlight.js seems to be one of the most popular libraries for syntax highlighting. Sometimes, its "auto guessing the language" feature leads to strange results. The feature can be turned off using "nohighlight" (instead of "language-...") as class for the code

<pre><code class="nohighlight">...</code></pre>

Currently, flexmark renders fenced code blocks without language specification as code without a class attribute, thus "triggering" the auto guessing feature. It would be nice to be able to prevent auto guessing for the complete generated markup with a new option FENCED_CODE_LANGUAGE_DEFAULT_CLASS. When set, fenced code blocks without language would be rendered as code with a class attribute with the specified value.

Setting FENCED_CODE_LANGUAGE_DEFAULT_CLASS = "nohighlight" would then turn off auto guessing for the complete generated document.

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