2

I know you can do

```html
some html code
```

to make it highlight in html syntax.

Is there something like below?

```nohighlight
some code that shouldn't be highlighted
```
stackoverflower
  • 3,885
  • 10
  • 47
  • 71
  • 2
    For those voting to close, thinking the topic belong to meta stackoverflow: the question is about "[stackedit](https://stackedit.io/)", not "stackoverflow". – stackoverflower Dec 08 '15 at 22:46
  • For all the people wondering how to do this on **StackOverflow**: use [`lang-none`](https://meta.stackoverflow.com/q/360759/). – m93a May 17 '22 at 11:03

1 Answers1

2

This is configurable in the settings. To open settings, from within a document select the # tab in the top left corner and from the sidebar which slides out, select Settings (second to last line).

enter image description here

In the Settings dialog box, select the Extensions tab.

enter image description here

Scroll down and select the item Markdown Extra. A list of configuration options will expand to configure various aspects of the Pagedown Extra Plugin. The last item in the list is the option to select a syntax highlighter.

enter image description here

If you would like to turn off code highlighting for all code blocks, select None from the list and click OK.

If you select Highlight.js, setting the class no-highlight will disable highlighting for a given code block:

```no-highlight
some code that shouldn't be highlighted
```

If you select Prettify, setting the class nocode will disable highlighting for a given code block:

```nocode
some code that shouldn't be highlighted
```

Note that using the class no-highlight or nocode is documented in the respective highlighting tool's documentation. See the respective documentation for more specifics.

By way of explanation, both Highlight.js and Prettify's default behavior is to discover all code blocks and guess the language if one is not defined. Of course, sometimes you legitimately have a need to not have a code block highlighted. Therefore you need to specifically tell the highlighter to not guess for such a code block. Unfortunately, the way to do that is not standardized across tools. You need to determine which took is doing the highlighting and then consult that tool's documentation to determine the specifics.

Note that I did not specifically test using nocode with Prettify as I prefer Highlight.js. I simply referenced Prettify's docs. Using no-highlight with Highlight.js worked fine for me though. YMMV.

Waylan
  • 37,164
  • 12
  • 83
  • 109