Markdown issues in the timeline?

I have included some source code (actually the contents of a config file) in a post, something like:

```
# this is a comment
setting = 1
```

which displays correctly here and on my hosted blog:

# this is a comment
setting = 1

But in the timeline/post pages, the # is interpreted as a markdown heading, thus displays as:

```

this is a comment

setting = 1
```

(so it says it’s a comment, but actually is shown as a heading)

Presumably markdown parsing should be suspended within code sections, in part to allow for markdown to be included as a code block within a post?

I also prefer code fencing; but, it would appear indenting with four spaces does the trick as a workaround.

Update: I mean … without the syntax highlighting.

Another update: I would presume one could get around this with a Hugo shortcode to generate whatever tags are needed (I have never actually looked at how syntax highlighting gets marked up).

That’s for the tip - I never thought to play with the indentation. Sadly, indenting only partially worked for me:

Screenshot 2021-04-07 at 10.18.20

If I add extra new lines I can force the code to be correctly parsed, but then the backticks show in the post.

:man_shrugging:

Again, my hosted blog is fine, this is only in the timeline/posts pages on the m.b site.

1 Like

If it is limited to the timeline … yeah, not much to be done.