Skip to content

fenced_code markup not working inside a customblock #1

@mschwerhoff

Description

@mschwerhoff

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions