Incorporate the collapsible code block #39
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Something I use in the docs often is the
<details><summary>
html block which allows to embed code blocks of any size without losing out on the readibility - you can open and close the thing as you like.Now the problem is that Confluence doesn't parse it (or does it in a weird way - I don't remember) and instead they have their own collapsible something, which is enabled through a flag in the
code
macro. This PR enables it, as well as thetitle
field.It's a bit of funky way to do it, but luckily
github
's markdown/codeblock parser is flexible enough to allow this:And on confluence it looks this way:
Best part is that github's version looks as usual, seems like they just ignore the extra words.
If we wrap it in
We get
Hello this is a Beautiful codeblock
The lines that contain these tags have to be removed before uploading to confluence but that's specific to how I use it so may not apply to everyone - otherwise piping the file through
sed /<\/\?details>\|<\/\?summary>/d
removes them.Let me know if I should remove the
printfs
from the template - it's a rather subjective change so I'm happy to let them go if you have doubts about them.