How to block highlight?

I typed markdown text like this:

Model No. 349048
Name: name of the item

and hugo generated highlighted HTML. I would like to stop language auto detection on this page, because it has nothing to do with source code or configuration file.

How do I disable the highlight for this particular markdown file?

Thanks

Hugo has two highlighting mechanism for source code:

  1. Putting things in {{% highlight %}}…{{% /highlight %}} tags (using Pygments).
  2. Putting things in <pre><code></code></pre> blocks and using a JavaScript highlighter.

It doesn’t do any language auto-detection otherwise.

If you can paste (in a code block) the input that you put and add a screenshot of what you’re seeing, we might be able to figure out what’s going on, but I can’t see anything in what you put here that would turn into anything that would look highlighted there.

As to Markdown files, there are two more:

a) Wrap it in code fences

```some code```

b) Indent code lines with 4 characters

But those still shouldn’t result in syntax highlighting without one of the other preconditions (that is, code fences and 4 space indentation create <pre><code>…</code></pre> blocks highlighted by a JS highlighter).

Hugo can disable code highlighting for a code block, but for a .md files. check this:

some code.

or
```nohightlight
some code.
```

Hope it help. Cheers~

1 Like

I can confirm that this works. Only the word is

nohighlight

There is an extraneous t in the answer from @neotan which should be removed but that is obvious.

Basically any string that’s not a valid lexer works.

I do:

```text
```

Even this works :slight_smile:

```foo
```
1 Like

A post was split to a new topic: Create code block without syntax highlighting or line numbers