Skip to content

bollwyvl/jademagic

Repository files navigation

jademagic

an IPython magic for authoring HTML in Jade ne Pug.

Install

From the command line (or with ! in a notebook cell):

pip install jademagic

Enable

Ad-hoc

In the notebook, you can use the %load_ext or %reload_ext line magic.

%reload_ext jademagic

Configuration

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']

Use

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>'

Contribute

Issues and pull requests welcome!

License

jademagic is released as free software under the BSD 3-Clause license.

Thank

  • @lbustelo for challenging me to an alternative to %%html

About

Write HTML sanely in the IPython notebook with Jade (ne Pug)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published