Tangle reactive documents in the IPython Notebook
Project description
IPyTangle
=========
|build status|
Reactive narratives inspired by
`Tangle <http://worrydream.com/Tangle/>`__ in the `Jupyter
Notebook <http://jupyter.org>`__.
IPyTangle makes plain markdown into an interactive part of your
data-driven narrative.
This python...
.. code:: python
from ipytangle import tangle
tangle(cookies=3, calories=lambda cookies: cookies * 50)
Would connect to this markdown:
.. code:: markdown
When you eat [`cookies` cookies](#:cookies), you consume [`calories` calories](#:calories).
Would give you something like this:
When you eat ```2`` cookies <#:cookies>`__, you consume ```150``
calories <#:>`__.
And interacting with the links would cause the result to update.
See `the examples <./examples>`__!
.. |build status| image:: https://travis-ci.org/bollwyvl/ipytangle.svg
:target: https://travis-ci.org/bollwyvl/ipytangle
Screenshot
----------
.. figure:: screenshots/cookies/02.png
:alt:
Markdown
~~~~~~~~
``ipytangle`` implements most of
`TangleKit <https://github.com/worrydream/Tangle/blob/master/TangleKit/TangleKit.js>`__
baseline as markdown links. Unrendered tangle markdown should still
render in a useful way:
templates
~~~~~~~~~
Backticks, **\`\`** are used to represent a JavaScript expression
that will be updated on interaction (or cascading updates). In
addition to any variables defined with ``ipytangle``, some
`formatting <#Formatting>`__ libraries are provided. ``window``
globals should also work :wink:.
Only the generated ``code`` will be transformed, the rest of the
elements (if any) will be preserved.
- just display a field
.. code:: markdown
For [`years` years](#:) have I trained Jedi.
- display and update an integer based on dragging
.. code:: markdown
[made the kessel run in `distance` parsecs](#:distance)
- mark some text (which may have other fields) to only display based on
condition
.. code:: markdown
What's more foolish? The [`fool_is_more_foolish`](#:if)fool[](#:else)the fool who follows him(#:endif).
you may also have an ``else`` and any number of ``elsif``\ s...
because they are markdown span-level elements, you may use newlines
for easier editing
.. code:: markdown
[`feeling == "bad"`](#:if) I have a bad feeling about this.
[`feeling == "cautious"`](#:elif) You will never find a more wretched hive of scum and villainy.
[](#:else) Search your feelings.
[](#:endif)
Backend
~~~~~~~
- connects to any IPython widget
Formatting
~~~~~~~~~~
- bundles several nice libraries and shortcuts for formatting text:
- `moment <http://momentjs.com/>`__ dates and times
- `mathjs <http://mathjs.org/>`__ scientific units
- `numeral <http://numeraljs.com/>`__ currency, and miscellany
Inspiration
-----------
Of course, Brett Victor's `Tangle <http://worrydream.com/Tangle/>`__ is
the primary inspiration, as well as: -
`tributary <http://tributary.io/>`__ - `derby <http://derbjys.org>`__ -
`d3 <http://d3js.org>`__
Roadmap
-------
- support
`TangleKit <https://github.com/worrydream/Tangle/blob/master/TangleKit/TangleKit.js>`__
baseline
- float
- switch
- :math:`L_AT^EX` (sic)
- sparklines, distributions, etc.
=========
|build status|
Reactive narratives inspired by
`Tangle <http://worrydream.com/Tangle/>`__ in the `Jupyter
Notebook <http://jupyter.org>`__.
IPyTangle makes plain markdown into an interactive part of your
data-driven narrative.
This python...
.. code:: python
from ipytangle import tangle
tangle(cookies=3, calories=lambda cookies: cookies * 50)
Would connect to this markdown:
.. code:: markdown
When you eat [`cookies` cookies](#:cookies), you consume [`calories` calories](#:calories).
Would give you something like this:
When you eat ```2`` cookies <#:cookies>`__, you consume ```150``
calories <#:>`__.
And interacting with the links would cause the result to update.
See `the examples <./examples>`__!
.. |build status| image:: https://travis-ci.org/bollwyvl/ipytangle.svg
:target: https://travis-ci.org/bollwyvl/ipytangle
Screenshot
----------
.. figure:: screenshots/cookies/02.png
:alt:
Markdown
~~~~~~~~
``ipytangle`` implements most of
`TangleKit <https://github.com/worrydream/Tangle/blob/master/TangleKit/TangleKit.js>`__
baseline as markdown links. Unrendered tangle markdown should still
render in a useful way:
templates
~~~~~~~~~
Backticks, **\`\`** are used to represent a JavaScript expression
that will be updated on interaction (or cascading updates). In
addition to any variables defined with ``ipytangle``, some
`formatting <#Formatting>`__ libraries are provided. ``window``
globals should also work :wink:.
Only the generated ``code`` will be transformed, the rest of the
elements (if any) will be preserved.
- just display a field
.. code:: markdown
For [`years` years](#:) have I trained Jedi.
- display and update an integer based on dragging
.. code:: markdown
[made the kessel run in `distance` parsecs](#:distance)
- mark some text (which may have other fields) to only display based on
condition
.. code:: markdown
What's more foolish? The [`fool_is_more_foolish`](#:if)fool[](#:else)the fool who follows him(#:endif).
you may also have an ``else`` and any number of ``elsif``\ s...
because they are markdown span-level elements, you may use newlines
for easier editing
.. code:: markdown
[`feeling == "bad"`](#:if) I have a bad feeling about this.
[`feeling == "cautious"`](#:elif) You will never find a more wretched hive of scum and villainy.
[](#:else) Search your feelings.
[](#:endif)
Backend
~~~~~~~
- connects to any IPython widget
Formatting
~~~~~~~~~~
- bundles several nice libraries and shortcuts for formatting text:
- `moment <http://momentjs.com/>`__ dates and times
- `mathjs <http://mathjs.org/>`__ scientific units
- `numeral <http://numeraljs.com/>`__ currency, and miscellany
Inspiration
-----------
Of course, Brett Victor's `Tangle <http://worrydream.com/Tangle/>`__ is
the primary inspiration, as well as: -
`tributary <http://tributary.io/>`__ - `derby <http://derbjys.org>`__ -
`d3 <http://d3js.org>`__
Roadmap
-------
- support
`TangleKit <https://github.com/worrydream/Tangle/blob/master/TangleKit/TangleKit.js>`__
baseline
- float
- switch
- :math:`L_AT^EX` (sic)
- sparklines, distributions, etc.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ipytangle-0.1.0.tar.gz
(624.1 kB
view details)
Built Distribution
File details
Details for the file ipytangle-0.1.0.tar.gz
.
File metadata
- Download URL: ipytangle-0.1.0.tar.gz
- Upload date:
- Size: 624.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d62394a39b2e9dc034ab7f1df51c62a35a5006dfd44ee3acd83b146d218bedf |
|
MD5 | 1da4e7c83fa37e865fdf85d1a01e2b86 |
|
BLAKE2b-256 | 08c9de041eb876478a9f1eb2786b9b6ee7658e866fd844f992018d5fea2e4624 |
Provenance
File details
Details for the file ipytangle-0.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: ipytangle-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 1.2 MB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f41154230c8a32a4dc82c0a8b6e59f458ef5611dcd76611bbe43921e199e92d |
|
MD5 | 35ba1ea373b17c45c7115fb6bf1a9ece |
|
BLAKE2b-256 | ffac72b25b3dd6300d58de69395bb608d06ebc9814f7b35eaa42235dd728e969 |