Skip to content

pidgy magics¤

pidgy provides magics to introspect parts of the literate computing process.

  1. %%parse
    parse markdown in markdown-it-py tokens
  2. %%tangle
    parse then translate markdown to python
  3. %%weave
    display the markdown as an interactive, templating display
  4. %%pidgy
    executed the %%tangle python code and display the %%weave of 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.

cell magics are an IPython convention not generally available in python that help with interactive computing.

[Token(type='paragraph_open', tag='p', nesting=1, attrs={}, map=[0, 1], level=0, children=None, content='', markup='', info='', meta={}, block=True, hidden=False),
 Token(type='inline', tag='', nesting=0, attrs={}, map=[0, 1], level=1, children=[Token(type='code_inline', tag='code', nesting=0, attrs={}, map=None, level=0, children=None, content='%%parse', markup='`', info='', meta={}, block=False, hidden=False), Token(type='text', tag='', nesting=0, attrs={}, map=None, level=0, children=None, content=' helps to peek at the tokens that make up the markdown.', markup='', info='', meta={}, block=False, hidden=False)], content='`%%parse` helps to peek at the tokens that make up the markdown.', markup='', info='', meta={}, block=True, hidden=False),
 Token(type='paragraph_close', tag='p', nesting=-1, attrs={}, map=None, level=0, children=None, content='', markup='', info='', meta={}, block=True, hidden=False)]

markdown as python¤

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.""";

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¤


def pidgy():

%%pidgy is parts of %%tangle and %%weave.


pidgy without the extension¤


def pidgy():

%%pidgy is parts of %%tangle and %%weave.