Skip to content

Commit 05f1652

Browse files
committed
📚 DOCS: Format docs with mdformat-myst
1 parent b1a74b4 commit 05f1652

File tree

6 files changed

+59
-53
lines changed

6 files changed

+59
-53
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,19 @@ exclude: >
99
test.*\.html|
1010
test.*\.xml|
1111
.*commonmark\.json|
12-
benchmark/.*\.md|
12+
benchmarking/.*\.md|
1313
.*/spec\.md
1414
)$
1515
1616
repos:
1717

18+
- repo: https://github.com/executablebooks/mdformat
19+
rev: 0.7.2
20+
hooks:
21+
- id: mdformat
22+
args: [--number]
23+
additional_dependencies: [mdformat-myst==0.1.1]
24+
1825
- repo: https://github.com/pre-commit/pre-commit-hooks
1926
rev: v3.3.0
2027
hooks:

CHANGELOG.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ There are four notable (and breaking) changes:
3535

3636
This release brings Markdown-It-Py inline with Markdown-It v11.0.1 (2020-09-14), applying two fixes:
3737

38-
- Fix blockquote lazy newlines, [[#696](https://github.com/markdown-it/markdown-it/issues/696)].
39-
- Fix missed mappings for table rows, [[#705](https://github.com/markdown-it/markdown-it/issues/705)].
38+
- Fix blockquote lazy newlines, \[[#696](https://github.com/markdown-it/markdown-it/issues/696)\].
39+
- Fix missed mappings for table rows, \[[#705](https://github.com/markdown-it/markdown-it/issues/705)\].
4040

4141
Thanks to [@hukkinj1](https://github.com/hukkinj1)!
4242

@@ -126,27 +126,29 @@ md = MarkdownIt().use(tasklists_plugin)
126126
- ✨ NEW: Add simple typographic replacements, thanks to [@tsutsu3](https://github.com/tsutsu3):
127127
This allows you to add the `typographer` option to the parser, to replace particular text constructs:
128128

129-
- ``(c)``, ``(C)`` → ©
130-
- ``(tm)``, ``(TM)`` → ™
131-
- ``(r)``, ``(R)`` → ®
132-
- ``(p)``, ``(P)`` → §
133-
- ``+-`` → ±
134-
- ``...`` → …
135-
- ``?....`` → ?..
136-
- ``!....`` → !..
137-
- ``????????`` → ???
138-
- ``!!!!!`` → !!!
139-
- ``,,,`` → ,
140-
- ``--`` → &ndash
141-
- ``---`` → &mdash
129+
- `(c)`, `(C)` → ©
130+
- `(tm)`, `(TM)` → ™
131+
- `(r)`, `(R)` → ®
132+
- `(p)`, `(P)` → §
133+
- `+-` → ±
134+
- `...` → …
135+
- `?....` → ?..
136+
- `!....` → !..
137+
- `????????` → ???
138+
- `!!!!!` → !!!
139+
- `,,,` → ,
140+
- `--` → &ndash
141+
- `---` → &mdash
142142

143143
```python
144144
md = MarkdownIt().enable("replacements")
145145
md.options["typographer"] = True
146146
```
147147

148148
- 📚 DOCS: Improve documentation for CLI, thanks to [@westurner](https://github.com/westurner)
149+
149150
- 👌 IMPROVE: Use `re.sub()` instead of `re.subn()[0]`, thanks to [@hukkinj1](https://github.com/hukkinj1)
151+
150152
- 🐛 FIX: An exception raised by having multiple blank lines at the end of some files
151153

152154
## 0.5.5 - 2020-09-27

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# markdown-it-py
22

3-
[![Github-CI][github-ci]][github-link]
3+
[![Github-CI]][github-link]
44
[![Coverage Status][codecov-badge]][codecov-link]
55
[![PyPI][pypi-badge]][pypi-link]
66
[![Conda][conda-badge]][conda-link]
@@ -38,6 +38,7 @@ pip install markdown-it-py
3838
## Usage
3939

4040
### Python API Usage
41+
4142
Render markdown to HTML with markdown-it-py and a custom configuration
4243
with and without plugins and features:
4344

@@ -75,6 +76,7 @@ html_text = md.render(text)
7576
```
7677

7778
### Command-line Usage
79+
7880
Render markdown to HTML with markdown-it-py from the
7981
command-line:
8082

@@ -118,22 +120,20 @@ Big thanks to the authors of [markdown-it]:
118120

119121
Also [John MacFarlane](https://github.com/jgm) for his work on the CommonMark spec and reference implementations.
120122

121-
[github-ci]: https://github.com/executablebooks/markdown-it-py/workflows/Python%20package/badge.svg?branch=master
122-
[github-link]: https://github.com/executablebooks/markdown-it-py
123-
[pypi-badge]: https://img.shields.io/pypi/v/markdown-it-py.svg
124-
[pypi-link]: https://pypi.org/project/markdown-it-py
125-
[conda-badge]: https://anaconda.org/conda-forge/markdown-it-py/badges/version.svg
126-
[conda-link]: https://anaconda.org/conda-forge/markdown-it-py
127-
[codecov-badge]: https://codecov.io/gh/executablebooks/markdown-it-py/branch/master/graph/badge.svg
128-
[codecov-link]: https://codecov.io/gh/executablebooks/markdown-it-py
129123
[black-badge]: https://img.shields.io/badge/code%20style-black-000000.svg
130124
[black-link]: https://github.com/ambv/black
125+
[codecov-badge]: https://codecov.io/gh/executablebooks/markdown-it-py/branch/master/graph/badge.svg
126+
[codecov-link]: https://codecov.io/gh/executablebooks/markdown-it-py
127+
[conda-badge]: https://anaconda.org/conda-forge/markdown-it-py/badges/version.svg
128+
[conda-link]: https://anaconda.org/conda-forge/markdown-it-py
129+
[github-ci]: https://github.com/executablebooks/markdown-it-py/workflows/Python%20package/badge.svg?branch=master
130+
[github-link]: https://github.com/executablebooks/markdown-it-py
131131
[install-badge]: https://img.shields.io/pypi/dw/markdown-it-py?label=pypi%20installs
132132
[install-link]: https://pypistats.org/packages/markdown-it-py
133-
134-
[CommonMark spec]: http://spec.commonmark.org/
135133
[markdown-it]: https://github.com/markdown-it/markdown-it
136134
[markdown-it-readme]: https://github.com/markdown-it/markdown-it/blob/master/README.md
137-
[md-security]: https://markdown-it-py.readthedocs.io/en/latest/other.html
138135
[md-performance]: https://markdown-it-py.readthedocs.io/en/latest/other.html
139136
[md-plugins]: https://markdown-it-py.readthedocs.io/en/latest/plugins.html
137+
[md-security]: https://markdown-it-py.readthedocs.io/en/latest/other.html
138+
[pypi-badge]: https://img.shields.io/pypi/v/markdown-it-py.svg
139+
[pypi-link]: https://pypi.org/project/markdown-it-py

docs/architecture.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ An `env` sandbox can be used alongside tokens to inject external variables for y
4040

4141
Each chain (core / block / inline) uses an independent `state` object when parsing data, so that each parsing operation is independent and can be disabled on the fly.
4242

43-
4443
## Token stream
4544

4645
Instead of traditional AST we use more low-level data representation - *tokens*.
@@ -73,7 +72,6 @@ More details about tokens:
7372
- [Token source](https://github.com/executablebooks/markdown-it-py/tree/master/markdown_it/token.py)
7473
- [Live demo](https://markdown-it.github.io/) - type your text and click `debug` tab.
7574

76-
7775
## Rules
7876

7977
Rules are functions, doing "magic" with parser `state` objects. A rule is associated with one or more *chains* and is unique. For instance, a `blockquote` token is associated with `blockquote`, `paragraph`, `heading` and `list` chains.
@@ -93,7 +91,6 @@ Also, in complex cases you can try to ask for help in tracker. Condition is very
9391
simple - it should be clear from your ticket, that you studied docs, sources,
9492
and tried to do something yourself. We never reject with help to real developers.
9593

96-
9794
## Renderer
9895

9996
After the token stream is generated, it's passed to a [renderer](https://github.com/executablebooks/markdown-it-py/tree/master/markdown_it/renderer.py).
@@ -157,7 +154,6 @@ renderer override, but can be more simple.
157154
You also can write your own renderer to generate other formats than HTML, such as
158155
JSON/XML... You can even use it to generate AST.
159156

160-
161157
## Summary
162158

163159
This was mentioned in [Data flow](#data-flow), but let's repeat sequence again:

docs/contributing.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,15 @@ For documentation build tests:
6868
Where possible try to port directly from that.
6969
It is usually better to modify existing code, instead of writing all from scratch.
7070
2. Try to find the right place for your plugin rule:
71-
- Will it conflict with existing markup (by priority)?
72-
- If yes - you need to write an inline or block rule.
73-
- If no - you can morph tokens within core chains.
74-
- Remember that token morphing in core chains is always more simple than writing
75-
block or inline rules, if you don't copy existing ones. However,
76-
block and inline rules are usually faster.
77-
- Sometimes, it's enough to only modify the renderer, for example, to add
78-
header IDs or `target="_blank"` for the links.
71+
72+
- Will it conflict with existing markup (by priority)?
73+
- If yes - you need to write an inline or block rule.
74+
- If no - you can morph tokens within core chains.
75+
- Remember that token morphing in core chains is always more simple than writing
76+
block or inline rules, if you don't copy existing ones. However,
77+
block and inline rules are usually faster.
78+
- Sometimes, it's enough to only modify the renderer, for example, to add
79+
header IDs or `target="_blank"` for the links.
7980

8081
## FAQ
8182

docs/using.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,19 @@ The `smartquotes` and `replacements` components are intended to improve typograp
124124

125125
`replacements` will replace particular text constructs:
126126

127-
- ``(c)``, ``(C)`` → ©
128-
- ``(tm)``, ``(TM)`` → ™
129-
- ``(r)``, ``(R)`` → ®
130-
- ``(p)``, ``(P)`` → §
131-
- ``+-`` → ±
132-
- ``...`` → …
133-
- ``?....`` → ?..
134-
- ``!....`` → !..
135-
- ``????????`` → ???
136-
- ``!!!!!`` → !!!
137-
- ``,,,`` → ,
138-
- ``--`` → &ndash
139-
- ``---`` → &mdash
127+
- `(c)`, `(C)` → ©
128+
- `(tm)`, `(TM)` → ™
129+
- `(r)`, `(R)` → ®
130+
- `(p)`, `(P)` → §
131+
- `+-` → ±
132+
- `...` → …
133+
- `?....` → ?..
134+
- `!....` → !..
135+
- `????????` → ???
136+
- `!!!!!` → !!!
137+
- `,,,` → ,
138+
- `--` → &ndash
139+
- `---` → &mdash
140140

141141
Both of these components require typography to be turned on, as well as the components enabled:
142142

0 commit comments

Comments
 (0)