Hiding lines from code blocks #7113
-
Is there a way to hide lines in the rendered code blocks? I'm running the code blocks as a part of my doctest test suite and it would be useful to have some setup/teardown code in the code blocks that could be hidden from the rendered documentation. Right now I'm adding my teardown code in a comment after the code block:
However, it would be nice if I could do something like this:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hello @ollipa,
However, after looking at the source code, I see that |
Beta Was this translation helpful? Give feedback.
Hello @ollipa,
after consulting the SuperFences and Highlight docs I don't see any option to hide lines:
However, after looking at the source code, I see that
hl_lines
is passed to theHighlight.highlight
function together with thesrc
code to be highlighted. So you could create ahook
which adds a decorator function to monkey-patch eitherHighlight.highlight
orSuperFencesBlockPreprocessor.highlight
to handle your ownhide_lines
attribute and remove the lines yourself. The hook needs to patch the function before it's invoked, so likely theo…