Skip to content

RST nodes to ipynb mapping

AakashGC edited this page Feb 12, 2020 · 35 revisions

Nodes from docutils (scroll down to see nodes added by sphinx and sphinxcontrib-jupyter)

Elements Links Ipynb representation
Structural Elements
document doc, source {"cells": [ ] }
section doc, source Every section starts with a title and in a new cell, Example:- "source": ["## Competitive Equilibrium with Distorting Taxes\n ..... "]
topic doc, source No direct mapping ```ruby
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
| sidebar                  |    [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#sidebar), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py)     |  No direct mapping, creates a new cell                        |
| **Structural Subelements** |       |                                |
| title                    |   [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#title), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py)      | One or more `#`, Example:-`"# Title"`                            |
| subtitle                 |    [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#subtitle), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py)     |   Creates a new cell starting from subtitle and with one heading level lower then title and is preceded by the title cell. Example:- `"source": ["## Subtitle\n ... "]`                    |
| decoration               |     [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#decoration), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py)    |   No direct mapping  |
| docinfo                  |  [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#docinfo), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py)       | As a definition list `<dt>` for ipynb target in `sphinxcontrib-jupyter`                             |
| transition               |   [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#transition), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py)      |  No direct mapping
| **Bibliographic Elements** |       |                                |
| address                    | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#address), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | `Address` key implemented as `dt` and value implemented as `dd` in `sphinxcontrib-jupyter`
| author                     | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#author), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | `Author` key implemented as `dt` and value implemented as `dd` in `sphinxcontrib-jupyter`
| authors                    | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#authors), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | `Authors` key implemented as `dt` and value implemented as `dd` in `sphinxcontrib-jupyter`
| contact                    | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#contact), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | `contact` key implemented as `dt` and value implemented as `dd` in `sphinxcontrib-jupyter`
| copyright                  | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#copyright), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | `copyright` key implemented as `dt` and value implemented as `dd` in `sphinxcontrib-jupyter`
| date                       | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#date), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | `date` key implemented as `dt` and value implemented as `dd` in `sphinxcontrib-jupyter`
| organization               | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#organization), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | `organization` key implemented as `dt` and value implemented as `dd` in `sphinxcontrib-jupyter`
| revision                   | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#revision), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | `revision` key implemented as `dt` and value implemented as `dd` in `sphinxcontrib-jupyter`
| status                     | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#status), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | `status` key implemented as `dt` and value implemented as `dd` in `sphinxcontrib-jupyter`
| version                    | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#version), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | `version` key implemented as `dt` and value implemented as `dd` in `sphinxcontrib-jupyter`
| **Decorative Elements** |          |                                |
| footer                     | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#footer), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | No direct mapping
| header                     | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#header), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | No direct mapping
| **Body Elements** |
| **Simple Body Elements**
| comment                    | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#comment), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | No direct mapping
| doctest_block              | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#doctest-block), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | Triple nested block quote because of the syntax 
| image                      | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#image), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | `![]()` as markdown or html `img` tag which gives more formatting control
| literal_block              | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#literal-block), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | code cell
| math_block                 | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#math-block), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | "$$ ... $$" or can also render [MathJax subset of Tex and LaTeX](https://docs.mathjax.org/en/latest/input/tex/)
| paragraph                  | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#paragraph), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | Rendered as simple text, no extra syntax
| pending                    | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#pending), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | No direct mapping
| raw                        | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#raw), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| rubric                     | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#rubric), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| substitution_definition    | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#substitution-definition), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| target                     | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#target), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| **Simple Body Subelements**
| attribution                | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#attribution), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) |
| caption                    | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#caption), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| classifier                 | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#classifier), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| colspec                    | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#colspec), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| field_name                 | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#field-name), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| label                      | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#label), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| line                       | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#line), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| option_argument            | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#option-argument), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| option_string              | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#option-string), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| term                       | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#term), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| **Compound Body Elements**
| admonition                 | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#admonition), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| attention                  | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#attention), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| block_quote                | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#block-quote), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) |  
| bullet_list                | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#bullet-list), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| caution                    | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#caution), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| citation                   | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#citation), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| compound                   | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#compound), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| container| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#container), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| danger | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#danger), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| definition_list | [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#definition-list), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| enumerated_list| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#enumerated-list), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| error| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#error), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| field_list| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#field-list), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| figure| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#figure), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) |    
| footnote| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#footnote), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| hint| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#hint), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| important| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#important), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| line_block| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#line-block), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| note| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#note), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| option_list| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#option-list), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| system_message| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#system-message), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| table| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#table), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| tip| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#tip), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| warning| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#warning), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| **Compound Body Subelements**
| definition| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#definition), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| definition_list_item| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#definition-list-item), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) |  
| description| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#description), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| entry| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#entry), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| field| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#field), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| field_body| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#field-body), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| legend| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#legend), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| list_item| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#list-item), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| option| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#option), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| option_group| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#option-group), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| option_list_item| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#option-list-item), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| row| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#row), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| tbody| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#tbody), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| tgroup| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#tgroup), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| thead| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#thead), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| **Inline Elements**
| abbreviation| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#abbreviation), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| acronym| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#acronym), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| citation_reference| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#citation-reference), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| emphasis| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#emphasis), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| footnote_reference| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#footnote-reference), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| generated| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#generated), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| inline| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#inline), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| literal| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#literal), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| math| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#math), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| problematic| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#problematic), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| reference| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#reference), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| strong| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#strong), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| subscript| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#subscript), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| substitution_reference| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#substitution-reference), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| superscript| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#superscript), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) | 
| title_reference| [doc](http://docutils.sourceforge.net/docs/ref/doctree.html#title-reference), [source](https://github.com/QuantEcon/docutils-mirror/blob/master/docutils/nodes.py) |