an IPython magic for authoring HTML in Jade ne Pug.
From the command line (or with !
in a notebook cell):
pip install jademagic
In the notebook, you can use the %load_ext
or %reload_ext
line magic.
%reload_ext jademagic
In your profile's ipython_kernel_config.py
, you can add the following line to automatically load jademagic
into all your running kernels:
c.InteractiveShellApp.extensions = ['jade_magic']
The %%jade
cell magic will either act as simple parser:
%%jade
ul
each x in [1, 2, 3, 4, 5]
li: i.fa.fa-gift(class='fa-#{x}x')
<IPython.core.display.Javascript object>
which can be accessed by the special last result variable _
:
_
Or will update a named variable with the parsed document:
%%jade spock
i.fa.fa-spock.fa-5x
<IPython.core.display.Javascript object>
spock
'<i class="fa fa-spock fa-5x"></i>'
Issues and pull requests welcome!
jademagic
is released as free software under the BSD 3-Clause license.
- @lbustelo for challenging me to an alternative to
%%html