You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `linkify` component requires that [linkify-it-py](https://github.com/tsutsu3/linkify-it-py) be installed (e.g. *via*`pip install markdown-it-py[linkify]`).
152
152
This allows URI autolinks to be identified, without the need for enclosing in `<>` brackets:
153
153
154
-
```{code-cell} python
154
+
```{jupyter-execute}
155
155
md = MarkdownIt("commonmark", {"linkify": True})
156
156
md.enable(["linkify"])
157
157
md.render("github.com")
@@ -163,7 +163,7 @@ Plugins load collections of additional syntax rules and render methods into the
163
163
A number of useful plugins are available in [`mdit_py_plugins`](https://github.com/executablebooks/mdit-py-plugins) (see [the plugin list](./plugins.md)),
164
164
or you can create your own (following the [markdown-it design principles](./architecture.md)).
165
165
166
-
```{code-cell} python
166
+
```{jupyter-execute}
167
167
from markdown_it import MarkdownIt
168
168
import mdit_py_plugins
169
169
from mdit_py_plugins.front_matter import front_matter_plugin
@@ -175,7 +175,7 @@ md = (
175
175
.use(footnote_plugin)
176
176
.enable('table')
177
177
)
178
-
text = ("""
178
+
text = ("""\
179
179
---
180
180
a: 1
181
181
---
@@ -188,7 +188,7 @@ A footnote [^1]
188
188
189
189
[^1]: some details
190
190
""")
191
-
md.render(text)
191
+
print(md.render(text))
192
192
```
193
193
194
194
## The Token Stream
@@ -197,7 +197,7 @@ md.render(text)
197
197
198
198
Before rendering, the text is parsed to a flat token stream of block level syntax elements, with nesting defined by opening (1) and closing (-1) attributes:
199
199
200
-
```{code-cell} python
200
+
```{jupyter-execute}
201
201
md = MarkdownIt("commonmark")
202
202
tokens = md.parse("""
203
203
Here's some *text*
@@ -211,37 +211,37 @@ Here's some *text*
211
211
Naturally all openings should eventually be closed,
212
212
such that:
213
213
214
-
```{code-cell} python
214
+
```{jupyter-execute}
215
215
sum([t.nesting for t in tokens]) == 0
216
216
```
217
217
218
218
All tokens are the same class, which can also be created outside the parser:
0 commit comments