Skip to content

Commit a095740

Browse files
authored
📚 Update docs (#292)
1 parent dcf40fc commit a095740

File tree

10 files changed

+76
-38
lines changed

10 files changed

+76
-38
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ For details on [markdown-it] itself, see:
2424
- The __[Live demo](https://markdown-it.github.io)__
2525
- [The markdown-it README][markdown-it-readme]
2626

27+
**See also:** [markdown-it-pyrs](https://github.com/chrisjsewell/markdown-it-pyrs) for an experimental Rust binding,
28+
for even more speed!
29+
2730
## Installation
2831

2932
```bash
@@ -143,6 +146,6 @@ Also [John MacFarlane](https://github.com/jgm) for his work on the CommonMark sp
143146
[CommonMark spec]: http://spec.commonmark.org/
144147
[markdown-it]: https://github.com/markdown-it/markdown-it
145148
[markdown-it-readme]: https://github.com/markdown-it/markdown-it/blob/master/README.md
146-
[md-security]: https://markdown-it-py.readthedocs.io/en/latest/other.html
147-
[md-performance]: https://markdown-it-py.readthedocs.io/en/latest/other.html
149+
[md-security]: https://markdown-it-py.readthedocs.io/en/latest/security.html
150+
[md-performance]: https://markdown-it-py.readthedocs.io/en/latest/performance.html
148151
[md-plugins]: https://markdown-it-py.readthedocs.io/en/latest/plugins.html

benchmarking/bench_packages.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ def test_markdown_it_py(benchmark, spec_text):
1818
benchmark(parser.render, spec_text)
1919

2020

21+
@pytest.mark.benchmark(group="packages")
22+
def test_markdown_it_pyrs(benchmark, spec_text):
23+
import markdown_it_pyrs
24+
25+
parser = markdown_it_pyrs.MarkdownIt("commonmark")
26+
benchmark.extra_info["version"] = markdown_it_pyrs.__version__
27+
benchmark(parser.render, spec_text)
28+
29+
2130
@pytest.mark.benchmark(group="packages")
2231
def test_mistune(benchmark, spec_text):
2332
import mistune

docs/_static/markdown-it-py.svg

Lines changed: 24 additions & 0 deletions
Loading

docs/architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(md/architecture)=
22

3-
# markdown-it design principles
3+
# Design principles
44

55
(md/data-flow)=
66
## Data flow

docs/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,11 @@
6464
# a list of builtin themes.
6565
#
6666
html_title = "markdown-it-py"
67+
html_logo = html_favicon = "_static/markdown-it-py.svg"
6768
html_theme = "sphinx_book_theme"
6869
html_theme_options = {
70+
"home_page_in_toc": True,
71+
"use_repository_button": True,
6972
"use_edit_page_button": True,
7073
"repository_url": "https://github.com/executablebooks/markdown-it-py",
7174
"repository_branch": "master",

docs/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contribute to markdown-it-py
1+
# Contribute
22

33
We welcome all contributions! ✨
44

docs/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ Also [John MacFarlane](https://github.com/jgm) for his work on the CommonMark sp
3333
3434
using
3535
architecture
36-
other
36+
security
37+
performance
3738
plugins
3839
contributing
3940
api/markdown_it

docs/performance.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
(md/performance)=
2+
3+
# Performance
4+
5+
You can view our continuous integration benchmarking analysis at: <https://executablebooks.github.io/markdown-it-py/dev/bench/>,
6+
or you can run it for yourself within the repository:
7+
8+
```bash
9+
tox -e py311-bench-packages -- --benchmark-columns mean,stddev
10+
```
11+
12+
| package | version | mean (ms) | stddev |
13+
| -------------------- | ------- | --------- | ------- |
14+
| markdown-it-pyrs[^1] | 0.2.1 | 6.410 | 0.426 |
15+
| mistune[^2] | 3.0.1 | 80.409 | 2.335 |
16+
| **markdown-it-py** | 3.0.0 | 97.242 | 4.427 |
17+
| mistletoe | 1.1.0 | 99.633 | 4.628 |
18+
| commonmark-py | 0.9.1 | 300.403 | 9.706 |
19+
| pymarkdown | 3.4.3 | 387.775 | 10.394 |
20+
| pymarkdown (+extras) | 3.4.3 | 646.564 | 11.316 |
21+
| panflute | 2.3.0 | 860.105 | 208.607 |
22+
23+
As you can see, `markdown-it-py` doesn't pay with speed for it's flexibility.
24+
25+
[^1]: `markdown-it-pyrs` is a Rust implementation of `markdown-it-py`'s parser, in beta development, check it out at: <https://github.com/chrisjsewell/markdown-it-pyrs>
26+
[^2]: `mistune` is not CommonMark compliant, which is what allows for its
27+
faster parsing, at the expense of issues, for example, with nested inline parsing.
28+
See [mistletoes's explanation](https://github.com/miyuchina/mistletoe/blob/master/performance.md) for further details.

docs/other.md renamed to docs/security.md

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,34 +33,3 @@ If those depend on user input - always add prefixes to avoid DOM clobbering.
3333
See [discussion](https://github.com/markdown-it/markdown-it/issues/28) for details.
3434

3535
So, if you decide to use plugins that add extended class syntax or autogenerating header anchors - be careful.
36-
37-
(md/performance)=
38-
39-
# Performance
40-
41-
You can view our continuous integration benchmarking analysis at: <https://executablebooks.github.io/markdown-it-py/dev/bench/>,
42-
or you can run it for yourself within the repository:
43-
44-
```console
45-
$ tox -e py38-bench-packages -- --benchmark-columns mean,stddev
46-
47-
Name (time in ms) Mean StdDev
48-
---------------------------------------------------------------
49-
test_mistune 70.3272 (1.0) 0.7978 (1.0)
50-
test_mistletoe 116.0919 (1.65) 6.2870 (7.88)
51-
test_markdown_it_py 152.9022 (2.17) 4.2988 (5.39)
52-
test_commonmark_py 326.9506 (4.65) 15.8084 (19.81)
53-
test_pymarkdown 368.2712 (5.24) 7.5906 (9.51)
54-
test_pymarkdown_extra 640.4913 (9.11) 15.1769 (19.02)
55-
test_panflute 678.3547 (9.65) 9.4622 (11.86)
56-
---------------------------------------------------------------
57-
```
58-
59-
As you can see, `markdown-it-py` doesn't pay with speed for it's flexibility.
60-
61-
```{note}
62-
`mistune` is not CommonMark compliant, which is what allows for its
63-
faster parsing, at the expense of issues, for example, with nested inline parsing.
64-
See [mistletoes's explanation](https://github.com/miyuchina/mistletoe/blob/master/performance.md)
65-
for further details.
66-
```

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@ compare = [
3939
"commonmark~=0.9",
4040
"markdown~=3.4",
4141
"mistletoe~=1.0",
42-
"mistune~=2.0",
42+
"mistune~=3.0",
4343
"panflute~=2.3",
44+
"markdown-it-pyrs",
4445
]
4546
linkify = ["linkify-it-py>=1,<3"]
4647
plugins = ["mdit-py-plugins"]
4748
rtd = [
48-
"mdit-py-plugins @ git+https://github.com/executablebooks/mdit-py-plugins@master",
49+
"mdit-py-plugins",
4950
"myst-parser",
5051
"pyyaml",
5152
"sphinx",

0 commit comments

Comments
 (0)