pidgy magics¤
pidgy provides magics to introspect parts of the literate computing process.
-
%%parse- parse markdown in
markdown-it-pytokens
-
%%tangle- parse then translate markdown to python
-
%%weave- display the markdown as an interactive, templating display
-
%%pidgy- executed the
%%tanglepython code and display the%%weaveof the markdown
activate the magic extension¤
the magics are automatically activated in pidgy mode. the pidgy.magics extension can be used to partially opt-in to pidgy.
%reload_ext pidgy.magics
cell magics are an IPython convention not generally available in python
that help with interactive computing.
%%parse
`%%parse` helps to peek at the tokens that make up the markdown.
markdown as python¤
%%tangle
class tangle:
the `%%tangle` magic exists to interrogate how markdown transforms to python using `pidgy`s heuristics.
when this magic is used, none of the code is executed.
assert "tangle" not in locals(), F"{tangle} is registered"
weave magics¤
it is possible to use pidgys interactive display features without going full on.
displays in weave are interactive jinja2 templates.
interactively displaying the markdown¤
%%weave
<hr/>
def pidgy():
`%%pidgy` is parts of `%%tangle` and `%%weave`.
<hr/>
def pidgy():
%%pidgy is parts of %%tangle and %%weave.
pidgy without the extension¤
%%pidgy
<hr/>
def pidgy():
`%%pidgy` is parts of `%%tangle` and `%%weave`.
<hr/>
def pidgy():
%%pidgy is parts of %%tangle and %%weave.