Literate code for docs #537
pawamoy
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
Not keen on that I'm afraid. I'd want those examples to be runable from the command line, and without the The only real issue I have with the code in |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Didn't want to bother again you on Twitter so here are my result on trying to replicate your example with my Markdown Exec extension.
I add this code block in a Markdown page:
It uses the Snippet extension from PyMdown extensions to add the following snippet:
Not released yet, but I implemented a way to hide some lines: it simply hides line which contain
markdown-exec: hide
(language agnostic).The result is:
Now if you'd like to adopt Markdown Exec, note that you can avoid repeating the "os" and "export" parts thanks again to the Snippet extension, with two different methods.
First one: include the three snippets at once
Second one: include the pre/post snippets in the main snippet itself:
Of course you probably have more specific needs (like when you pass the lines and colums through attrs), so maybe you're better off writing/using your own special fence 🙂 I'm happy to improve Markdown Exec to suit your needs otherwise 😄
Beta Was this translation helpful? Give feedback.
All reactions