Home / GitHub Page

Default Formatter for Code Block

The default language for code blocks is something other than plaintext. I say this because it is doing some sort of highlighting.

  1. What language is the default language for triple-backtick code blocks?
  2. Is it possible to set the default to plaintext?

TIA

2 Likes

This is a good question. I’ve noticed the same thing. Actually I believe this is not the only problem with the syntax highlighter.

Afaik the highlighter should determine the code and use the proper highlighting syntax. IMO the fallback should be plain text w/o highlighting, but this is apparently not the case or not working.
The problem is that not even

        ```text

works. It still highlights something.

I was trying to go through the code, but I couldn’t find the culprit.

The closest I have found to plain text is
```shell
Still highlights $ if it is the first character

Just found out that

  ```plaintext

works. Hmm, in any case, there are still some issues that should be fixed.

1 Like

Yes, i was actually going to post a bug ticket about this, ```text should work , and the default should be plaintext, before i knew how to set the language for markdown code blocks my notes from copying and pasting random stuff is colorful from it trying and failing to parse it

github apparently uses this yaml file (i think you need to pay attention to the ace_mode field) for what they support:

1 Like

If you want non-highlighted code, you need to indent the code with a tab or 4 spaces. If you wrap in triple backtick it will try to auto-detect the code. This is by design.