markdown-customblocks icon indicating copy to clipboard operation
markdown-customblocks copied to clipboard

fenced_code markup not working inside a customblock

Open mschwerhoff opened this issue 4 years ago • 2 comments

I've just started experimenting with custom blocks in the context of the website generator Pelican, and was wondering what the preferred/recommended way of nesting fenced code blocks under custom blocks is.

Pelican by default supportes the syntax from CodeHilite (the ⎵ characters denote significant whitespace), as well as fenced code blocks:

⎵⎵⎵⎵#!python
⎵⎵⎵⎵print("I'm a string")

and

⎵⎵⎵⎵:::python
⎵⎵⎵⎵print("I'm a string")

and also

```python
print("I'm a string")
```

The good news: the former two syntax directly work when nested under a custom block. E.g.:

::: myblock
⎵⎵⎵⎵A *regular* line of `Markdown` formatted text.

⎵⎵⎵⎵⎵⎵⎵⎵#!python
⎵⎵⎵⎵⎵⎵⎵⎵print("I'm deeply offended *äh* indented")

To avoid the deep indentation, I typically prefer the fenced code blocks style, and thus tried the following:

::: myblock
⎵⎵⎵⎵A *regular* line of `Markdown` formatted text.

⎵⎵⎵⎵```python
⎵⎵⎵⎵print("Less is more")
⎵⎵⎵⎵```

Since fenced code blocks are only supported at the document root level, this requires installing the SuperFences as well.

Are there any other (maybe better) options?

Also, feel free to use this write-up in an FAQ or elsewhere (and to close this "issue"), maybe it can help others that find themselves in a similar situation.

mschwerhoff avatar Jun 28 '20 11:06 mschwerhoff