Reputation: 19587
What I really love in Markdown is that I can do the following:
```
Enter```
In RST I have to do the following:
.. codeblock::
EnterEnterDoes RST has any simpler way to use codeblock without the need of preceding four spaces?
Upvotes: 3
Views: 1506
Reputation: 15055
There is nothing similar in reST to markdown's inline code block. There are only these options:
There are multiple ways to show syntax-highlighted literal code blocks in Sphinx: using reST doctest blocks; using reST literal blocks, optionally in combination with the highlight directive; using the code-block directive; and using the literalinclude directive.
If your editor lacks the ability to automatically indent code-block
, or does not allow you to select the block and indent four spaces, then the best option may be literalinclude
. It's especially useful if you refer to the same code repeatedly.
p.s. -- Try indenting four spaces after the second return. I tried in PyCharm, but it didn't indent, but maybe your editor will do it. There are several open issues for PyCharm.
Upvotes: 1