How to disable syntax highlighting?

Hello,

After having fixed the syntax highlighting for the last Jekyll (on Github pages), I would like now to disable it (in order to use another library, in JS, more accurate for the language).

We are using kramdown for markdown processing:

markdown: kramdown

I tried the following settings:

kramdown:
  input: false
  highlighter: false
  syntax_highlighter: false
  enable_coderay: false

this didn’t change anything, the <code> tags are still processed and are rendered with <p> HTML elements that get the CSS class of the highlighter. As a consequence, the <code> tags don’t contain the code as a string anymore, but a bunch of HTML. The JS highlighter can do nothing with them.

This had an effect:

redcarpet:
  extensions:
    no_fenced_code_blocks: true

it disabled the fenced code blocks, but it’s too much: this block

   ```lang
    def foo(): pass
   ```

is rendered as

lang def foo(): pass 

note the prefix “lang” + the <code> tag doesn’t get the “lang” class.

Interestingly, the fenced blocks delimited with tildes (~~~lang) still get syntax highlighting.

So I’d like something in between, like it was with Jekyll 3.6.3: extract the fenced code blocks into <code> tags with their class name, but not rendered as an inner HTML.

I feel I’m not that far, reading https://jekyllrb.com/docs/configuration/markdown/#redcarpet

With both fenced code blocks and highlighter enabled, this will statically highlight the code; without any syntax highlighter, it will add a class="LANGUAGE" attribute to the <code> element, which can be used as a hint by various JavaScript code highlighting libraries.

But how to not have any highlighter?

Thanks.

highlighter: none

I have not tested it, just posting what I found.

That does it, thank you.

You have good Google skills :slight_smile:

“highlighter: none” yields a Github-pages warning (on production, not locally). The important part is

kramdown:
    syntax_highlighter_opts:
      disable: true