mdformat-mkdocs 5.1.4__tar.gz → 5.2.0b0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/PKG-INFO +3 -1
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/README.md +2 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/__init__.py +2 -1
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/mdit_plugins/__init__.py +6 -0
- mdformat_mkdocs-5.2.0b0/mdformat_mkdocs/mdit_plugins/_mkdocstrings_injection.py +74 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/mdit_plugins/_python_markdown_attr_list.py +4 -2
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/plugin.py +85 -40
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/pyproject.toml +2 -2
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/LICENSE +0 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/_helpers.py +0 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/_normalize_list.py +0 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/_postprocess_inline.py +0 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/_synced/__init__.py +0 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/_synced/admon_factories/README.md +0 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/_synced/admon_factories/__init__.py +0 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/_synced/admon_factories/_whitespace_admon_factories.py +0 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/mdit_plugins/_material_admon.py +0 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/mdit_plugins/_material_content_tabs.py +0 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/mdit_plugins/_material_deflist.py +0 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/mdit_plugins/_mkdocstrings_autorefs.py +0 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/mdit_plugins/_mkdocstrings_crossreference.py +0 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/mdit_plugins/_pymd_abbreviations.py +0 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/mdit_plugins/_pymd_admon.py +0 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/mdit_plugins/_pymd_arithmatex.py +0 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/mdit_plugins/_pymd_captions.py +0 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/mdit_plugins/_pymd_snippet.py +0 -0
- {mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mdformat_mkdocs
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.2.0b0
|
|
4
4
|
Summary: An mdformat plugin for mkdocs and Material for MkDocs
|
|
5
5
|
Keywords: markdown,markdown-it,mdformat,mdformat_plugin_template
|
|
6
6
|
Author: kyleking
|
|
@@ -62,6 +62,8 @@ Supports:
|
|
|
62
62
|
- [MkDocs-Material Content Tabs\*](https://squidfunk.github.io/mkdocs-material/reference/content-tabs)
|
|
63
63
|
- \*Note: the markup (HTML) rendered by this plugin is sufficient for formatting but not for viewing in a browser. Please open an issue if you have a need to generate valid HTML.
|
|
64
64
|
- [MkDocs-Material Definition Lists](https://squidfunk.github.io/mkdocs-material/reference/lists/#using-definition-lists)
|
|
65
|
+
- [mkdocstrings Injection Blocks](https://mkdocstrings.github.io/usage/)
|
|
66
|
+
- Preserves `:::` identifier blocks and their indented YAML options verbatim
|
|
65
67
|
- [mkdocstrings Anchors (autorefs)](https://mkdocstrings.github.io/autorefs/#markdown-anchors)
|
|
66
68
|
- [mkdocstrings Cross-References](https://mkdocstrings.github.io/usage/#cross-references)
|
|
67
69
|
- [Python Markdown "Abbreviations"\*](https://squidfunk.github.io/mkdocs-material/reference/tooltips/#adding-abbreviations)
|
|
@@ -15,6 +15,8 @@ Supports:
|
|
|
15
15
|
- [MkDocs-Material Content Tabs\*](https://squidfunk.github.io/mkdocs-material/reference/content-tabs)
|
|
16
16
|
- \*Note: the markup (HTML) rendered by this plugin is sufficient for formatting but not for viewing in a browser. Please open an issue if you have a need to generate valid HTML.
|
|
17
17
|
- [MkDocs-Material Definition Lists](https://squidfunk.github.io/mkdocs-material/reference/lists/#using-definition-lists)
|
|
18
|
+
- [mkdocstrings Injection Blocks](https://mkdocstrings.github.io/usage/)
|
|
19
|
+
- Preserves `:::` identifier blocks and their indented YAML options verbatim
|
|
18
20
|
- [mkdocstrings Anchors (autorefs)](https://mkdocstrings.github.io/autorefs/#markdown-anchors)
|
|
19
21
|
- [mkdocstrings Cross-References](https://mkdocstrings.github.io/usage/#cross-references)
|
|
20
22
|
- [Python Markdown "Abbreviations"\*](https://squidfunk.github.io/mkdocs-material/reference/tooltips/#adding-abbreviations)
|
|
@@ -21,6 +21,10 @@ from ._mkdocstrings_crossreference import (
|
|
|
21
21
|
MKDOCSTRINGS_CROSSREFERENCE_PREFIX,
|
|
22
22
|
mkdocstrings_crossreference_plugin,
|
|
23
23
|
)
|
|
24
|
+
from ._mkdocstrings_injection import (
|
|
25
|
+
MKDOCSTRINGS_INJECTION_PREFIX,
|
|
26
|
+
mkdocstrings_injection_plugin,
|
|
27
|
+
)
|
|
24
28
|
from ._pymd_abbreviations import PYMD_ABBREVIATIONS_PREFIX, pymd_abbreviations_plugin
|
|
25
29
|
from ._pymd_admon import pymd_admon_plugin
|
|
26
30
|
from ._pymd_arithmatex import (
|
|
@@ -48,6 +52,7 @@ __all__ = (
|
|
|
48
52
|
"MKDOCSTRINGS_AUTOREFS_PREFIX",
|
|
49
53
|
"MKDOCSTRINGS_CROSSREFERENCE_PREFIX",
|
|
50
54
|
"MKDOCSTRINGS_HEADING_AUTOREFS_PREFIX",
|
|
55
|
+
"MKDOCSTRINGS_INJECTION_PREFIX",
|
|
51
56
|
"PYMD_ABBREVIATIONS_PREFIX",
|
|
52
57
|
"PYMD_CAPTIONS_PREFIX",
|
|
53
58
|
"PYMD_SNIPPET_PREFIX",
|
|
@@ -59,6 +64,7 @@ __all__ = (
|
|
|
59
64
|
"material_deflist_plugin",
|
|
60
65
|
"mkdocstrings_autorefs_plugin",
|
|
61
66
|
"mkdocstrings_crossreference_plugin",
|
|
67
|
+
"mkdocstrings_injection_plugin",
|
|
62
68
|
"pymd_abbreviations_plugin",
|
|
63
69
|
"pymd_admon_plugin",
|
|
64
70
|
"pymd_arithmatex_plugin",
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"""mkdocstrings injection blocks.
|
|
2
|
+
|
|
3
|
+
Matches:
|
|
4
|
+
|
|
5
|
+
```md
|
|
6
|
+
::: package.module.Class
|
|
7
|
+
options:
|
|
8
|
+
heading_level: 2
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Docs: https://mkdocstrings.github.io/usage/
|
|
12
|
+
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import re
|
|
18
|
+
from typing import TYPE_CHECKING
|
|
19
|
+
|
|
20
|
+
from mdit_py_plugins.utils import is_code_block
|
|
21
|
+
|
|
22
|
+
if TYPE_CHECKING:
|
|
23
|
+
from markdown_it import MarkdownIt
|
|
24
|
+
from markdown_it.rules_block import StateBlock
|
|
25
|
+
|
|
26
|
+
_INJECTION_PATTERN = re.compile(r"^:::\s+\S")
|
|
27
|
+
MKDOCSTRINGS_INJECTION_PREFIX = "mkdocstrings_injection"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _get_line(state: StateBlock, line: int, base_indent: int) -> str:
|
|
31
|
+
return state.src[state.bMarks[line] + base_indent : state.eMarks[line]]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _mkdocstrings_injection(
|
|
35
|
+
state: StateBlock,
|
|
36
|
+
start_line: int,
|
|
37
|
+
end_line: int,
|
|
38
|
+
silent: bool,
|
|
39
|
+
) -> bool:
|
|
40
|
+
if is_code_block(state, start_line):
|
|
41
|
+
return False
|
|
42
|
+
|
|
43
|
+
base_indent = state.blkIndent
|
|
44
|
+
header = _get_line(state, start_line, base_indent)
|
|
45
|
+
if not _INJECTION_PATTERN.match(header):
|
|
46
|
+
return False
|
|
47
|
+
|
|
48
|
+
if silent:
|
|
49
|
+
return True
|
|
50
|
+
|
|
51
|
+
lines = [header]
|
|
52
|
+
next_line = start_line + 1
|
|
53
|
+
while next_line < end_line:
|
|
54
|
+
if state.tShift[next_line] <= base_indent:
|
|
55
|
+
break
|
|
56
|
+
lines.append(_get_line(state, next_line, base_indent))
|
|
57
|
+
next_line += 1
|
|
58
|
+
|
|
59
|
+
token = state.push(MKDOCSTRINGS_INJECTION_PREFIX, "", 0)
|
|
60
|
+
token.content = "\n".join(lines)
|
|
61
|
+
token.block = True
|
|
62
|
+
token.map = [start_line, next_line]
|
|
63
|
+
|
|
64
|
+
state.line = next_line
|
|
65
|
+
return True
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def mkdocstrings_injection_plugin(md: MarkdownIt) -> None:
|
|
69
|
+
md.block.ruler.before(
|
|
70
|
+
"paragraph",
|
|
71
|
+
MKDOCSTRINGS_INJECTION_PREFIX,
|
|
72
|
+
_mkdocstrings_injection,
|
|
73
|
+
{"alt": ["paragraph"]},
|
|
74
|
+
)
|
|
@@ -40,13 +40,15 @@ def _python_markdown_attr_list(state: StateInline, silent: bool) -> bool:
|
|
|
40
40
|
|
|
41
41
|
# Look backwards for unclosed '['
|
|
42
42
|
search_start = max(0, state.pos - 100) # Limit backwards search
|
|
43
|
-
text_before = state.src[search_start:state.pos]
|
|
43
|
+
text_before = state.src[search_start : state.pos]
|
|
44
44
|
open_brackets = text_before.count("[") - text_before.count("]")
|
|
45
45
|
if open_brackets > 0:
|
|
46
46
|
# We might be inside a link, check if there's '](' after our match
|
|
47
47
|
match_end_pos = state.pos + match.end()
|
|
48
48
|
if match_end_pos < len(state.src):
|
|
49
|
-
lookahead = state.src[
|
|
49
|
+
lookahead = state.src[
|
|
50
|
+
match_end_pos : min(match_end_pos + 100, len(state.src))
|
|
51
|
+
]
|
|
50
52
|
if "](" in lookahead:
|
|
51
53
|
# Very likely inside link text, don't match
|
|
52
54
|
return False
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import re
|
|
5
6
|
import textwrap
|
|
6
7
|
from functools import partial
|
|
7
8
|
from typing import TYPE_CHECKING
|
|
@@ -10,7 +11,7 @@ from mdformat.renderer import DEFAULT_RENDERERS, RenderContext, RenderTreeNode
|
|
|
10
11
|
|
|
11
12
|
from ._helpers import ContextOptions, get_conf
|
|
12
13
|
from ._normalize_list import normalize_list as unbounded_normalize_list
|
|
13
|
-
from ._postprocess_inline import postprocess_list_wrap
|
|
14
|
+
from ._postprocess_inline import postprocess_list_wrap as _postprocess_list_wrap
|
|
14
15
|
from .mdit_plugins import (
|
|
15
16
|
AMSMATH_BLOCK,
|
|
16
17
|
DOLLARMATH_BLOCK,
|
|
@@ -19,6 +20,7 @@ from .mdit_plugins import (
|
|
|
19
20
|
MKDOCSTRINGS_AUTOREFS_PREFIX,
|
|
20
21
|
MKDOCSTRINGS_CROSSREFERENCE_PREFIX,
|
|
21
22
|
MKDOCSTRINGS_HEADING_AUTOREFS_PREFIX,
|
|
23
|
+
MKDOCSTRINGS_INJECTION_PREFIX,
|
|
22
24
|
PYMD_ABBREVIATIONS_PREFIX,
|
|
23
25
|
PYMD_CAPTIONS_PREFIX,
|
|
24
26
|
PYMD_SNIPPET_PREFIX,
|
|
@@ -30,6 +32,7 @@ from .mdit_plugins import (
|
|
|
30
32
|
material_deflist_plugin,
|
|
31
33
|
mkdocstrings_autorefs_plugin,
|
|
32
34
|
mkdocstrings_crossreference_plugin,
|
|
35
|
+
mkdocstrings_injection_plugin,
|
|
33
36
|
pymd_abbreviations_plugin,
|
|
34
37
|
pymd_admon_plugin,
|
|
35
38
|
pymd_arithmatex_plugin,
|
|
@@ -108,6 +111,7 @@ def update_mdit(mdit: MarkdownIt) -> None:
|
|
|
108
111
|
mdit.use(material_content_tabs_plugin)
|
|
109
112
|
mdit.use(material_deflist_plugin)
|
|
110
113
|
mdit.use(mkdocstrings_autorefs_plugin)
|
|
114
|
+
mdit.use(mkdocstrings_injection_plugin)
|
|
111
115
|
mdit.use(pymd_abbreviations_plugin)
|
|
112
116
|
mdit.use(pymd_admon_plugin)
|
|
113
117
|
mdit.use(pymd_snippet_plugin)
|
|
@@ -134,29 +138,42 @@ def _render_math_inline(node: RenderTreeNode, context: RenderContext) -> str: #
|
|
|
134
138
|
return f"${content}$"
|
|
135
139
|
|
|
136
140
|
|
|
141
|
+
def _strip_blockquote_markers(content: str) -> str:
|
|
142
|
+
"""Strip blockquote markers from math block content.
|
|
143
|
+
|
|
144
|
+
markdown-it includes "> " prefixes when block math appears inside blockquotes.
|
|
145
|
+
"""
|
|
146
|
+
lines = content.split("\n")
|
|
147
|
+
return "\n".join(
|
|
148
|
+
line.removeprefix("> ") if line.startswith("> ") else line for line in lines
|
|
149
|
+
).strip()
|
|
150
|
+
|
|
151
|
+
|
|
137
152
|
def _render_math_block(node: RenderTreeNode, context: RenderContext) -> str: # noqa: ARG001
|
|
138
153
|
"""Render block math with original delimiters."""
|
|
139
154
|
markup = node.markup
|
|
140
|
-
|
|
155
|
+
cleaned_content = _strip_blockquote_markers(node.content)
|
|
156
|
+
|
|
141
157
|
if markup == "$$":
|
|
142
|
-
return f"$$\n{
|
|
158
|
+
return f"$$\n{cleaned_content}\n$$"
|
|
143
159
|
if markup == "\\[":
|
|
144
|
-
return f"\\[\n{
|
|
160
|
+
return f"\\[\n{cleaned_content}\n\\]"
|
|
145
161
|
# Fallback
|
|
146
|
-
return f"$$\n{
|
|
162
|
+
return f"$$\n{cleaned_content}\n$$"
|
|
147
163
|
|
|
148
164
|
|
|
149
165
|
def _render_math_block_eqno(node: RenderTreeNode, context: RenderContext) -> str: # noqa: ARG001
|
|
150
166
|
"""Render block math with equation label."""
|
|
151
167
|
markup = node.markup
|
|
152
|
-
|
|
153
|
-
|
|
168
|
+
label = node.info
|
|
169
|
+
cleaned_content = _strip_blockquote_markers(node.content)
|
|
170
|
+
|
|
154
171
|
if markup == "$$":
|
|
155
|
-
return f"$$\n{
|
|
172
|
+
return f"$$\n{cleaned_content}\n$$ ({label})"
|
|
156
173
|
if markup == "\\[":
|
|
157
|
-
return f"\\[\n{
|
|
174
|
+
return f"\\[\n{cleaned_content}\n\\] ({label})"
|
|
158
175
|
# Fallback
|
|
159
|
-
return f"$$\n{
|
|
176
|
+
return f"$$\n{cleaned_content}\n$$ ({label})"
|
|
160
177
|
|
|
161
178
|
|
|
162
179
|
def _render_amsmath(node: RenderTreeNode, context: RenderContext) -> str: # noqa: ARG001
|
|
@@ -176,40 +193,53 @@ def _render_inline_content(node: RenderTreeNode, context: RenderContext) -> str:
|
|
|
176
193
|
return inline.content
|
|
177
194
|
|
|
178
195
|
|
|
179
|
-
|
|
180
|
-
|
|
196
|
+
_ESCAPED_LINK_SPACED_URL = re.compile(r"\\\[([^\]]*)\\\]\(([^)]*[ ][^)]*)\)")
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def _fix_links_with_spaced_urls(
|
|
200
|
+
text: str,
|
|
201
|
+
node: RenderTreeNode, # noqa: ARG001
|
|
202
|
+
context: RenderContext, # noqa: ARG001
|
|
203
|
+
) -> str:
|
|
204
|
+
"""Rewrite escaped links with space-containing URLs to angle-bracket syntax.
|
|
205
|
+
|
|
206
|
+
CommonMark requires link destinations with spaces to use angle brackets.
|
|
207
|
+
When markdown-it fails to parse [text](url with space) as a link, mdformat
|
|
208
|
+
escapes the brackets. Detects and repairs those cases.
|
|
209
|
+
|
|
210
|
+
Addresses: https://github.com/KyleKing/mdformat-mkdocs/issues/80
|
|
211
|
+
|
|
212
|
+
"""
|
|
213
|
+
return _ESCAPED_LINK_SPACED_URL.sub(
|
|
214
|
+
lambda m: f"[{m.group(1)}](<{m.group(2)}>)",
|
|
215
|
+
text,
|
|
216
|
+
)
|
|
181
217
|
|
|
182
|
-
`markdown-it` normalizes newlines in inline code to spaces. This can result in
|
|
183
|
-
unintended trailing spaces from original newlines before closing backticks.
|
|
184
|
-
Per mdformat's own logic, trailing spaces are only intentional if there are
|
|
185
|
-
also leading spaces. So we strip trailing spaces when there's no leading space.
|
|
186
218
|
|
|
187
|
-
|
|
219
|
+
def _render_text(node: RenderTreeNode, context: RenderContext) -> str:
|
|
220
|
+
r"""Re-escape dollar signs that mdformat core stripped.
|
|
188
221
|
|
|
189
|
-
|
|
190
|
-
|
|
222
|
+
mdformat removes "unnecessary" backslash escapes (\$ -> $), but with math enabled
|
|
223
|
+
those bare $ become math delimiters. Compares text content against the parent
|
|
224
|
+
inline token (which preserves backslashes) to detect and restore the escapes.
|
|
191
225
|
|
|
226
|
+
Related: https://github.com/KyleKing/mdformat-mkdocs/issues/77
|
|
192
227
|
"""
|
|
193
|
-
default_renderer = DEFAULT_RENDERERS.get("
|
|
228
|
+
default_renderer = DEFAULT_RENDERERS.get("text")
|
|
194
229
|
if default_renderer is None:
|
|
195
230
|
return node.content
|
|
196
231
|
|
|
197
|
-
|
|
232
|
+
text = default_renderer(node, context)
|
|
198
233
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
return result
|
|
202
|
-
|
|
203
|
-
content = result[1:-1] # Strip opening and closing backticks
|
|
204
|
-
has_leading_space = content.startswith(" ")
|
|
205
|
-
has_trailing_space = content.endswith(" ")
|
|
234
|
+
if cli_is_no_mkdocs_math(context.options):
|
|
235
|
+
return text
|
|
206
236
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
237
|
+
if node.parent and node.parent.type == "inline":
|
|
238
|
+
parent_content = node.parent.content
|
|
239
|
+
if "$" in text and r"\$" in parent_content:
|
|
240
|
+
text = re.sub(r"(?<!\\)\$", r"\$", text)
|
|
211
241
|
|
|
212
|
-
return
|
|
242
|
+
return text
|
|
213
243
|
|
|
214
244
|
|
|
215
245
|
def _render_heading_autoref(node: RenderTreeNode, context: RenderContext) -> str:
|
|
@@ -307,12 +337,12 @@ RENDERERS: Mapping[str, Render] = {
|
|
|
307
337
|
"admonition_title": render_admon_title,
|
|
308
338
|
"admonition_mkdocs": add_extra_admon_newline,
|
|
309
339
|
"admonition_mkdocs_title": render_admon_title,
|
|
310
|
-
"code_inline": _render_code_inline,
|
|
311
340
|
"content_tab_mkdocs": add_extra_admon_newline,
|
|
312
341
|
"content_tab_mkdocs_title": render_admon_title,
|
|
342
|
+
"dd": render_material_definition_body,
|
|
313
343
|
"dl": render_material_definition_list,
|
|
314
344
|
"dt": render_material_definition_term,
|
|
315
|
-
"
|
|
345
|
+
"text": _render_text,
|
|
316
346
|
# Math support (from mdit-py-plugins)
|
|
317
347
|
DOLLARMATH_INLINE: _render_math_inline,
|
|
318
348
|
DOLLARMATH_BLOCK: _render_math_block,
|
|
@@ -323,6 +353,7 @@ RENDERERS: Mapping[str, Render] = {
|
|
|
323
353
|
PYMD_CAPTIONS_PREFIX: render_pymd_caption,
|
|
324
354
|
MKDOCSTRINGS_AUTOREFS_PREFIX: _render_meta_content,
|
|
325
355
|
MKDOCSTRINGS_CROSSREFERENCE_PREFIX: _render_cross_reference,
|
|
356
|
+
MKDOCSTRINGS_INJECTION_PREFIX: _render_node_content,
|
|
326
357
|
MKDOCSTRINGS_HEADING_AUTOREFS_PREFIX: _render_heading_autoref,
|
|
327
358
|
PYMD_ABBREVIATIONS_PREFIX: _render_inline_content,
|
|
328
359
|
PYMD_SNIPPET_PREFIX: _render_inline_content,
|
|
@@ -330,10 +361,24 @@ RENDERERS: Mapping[str, Render] = {
|
|
|
330
361
|
}
|
|
331
362
|
|
|
332
363
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
364
|
+
if TYPE_CHECKING:
|
|
365
|
+
normalize_list: Postprocess
|
|
366
|
+
postprocess_inline: Postprocess
|
|
367
|
+
else:
|
|
368
|
+
normalize_list = partial(
|
|
369
|
+
unbounded_normalize_list,
|
|
370
|
+
check_if_align_semantic_breaks_in_lists=cli_is_align_semantic_breaks_in_lists,
|
|
371
|
+
)
|
|
372
|
+
|
|
373
|
+
def postprocess_inline(
|
|
374
|
+
text: str,
|
|
375
|
+
node: RenderTreeNode,
|
|
376
|
+
context: RenderContext,
|
|
377
|
+
) -> str:
|
|
378
|
+
"""Run all inline postprocessors in sequence."""
|
|
379
|
+
text = _postprocess_list_wrap(text, node, context)
|
|
380
|
+
return _fix_links_with_spaced_urls(text, node, context)
|
|
381
|
+
|
|
337
382
|
|
|
338
383
|
# A mapping from `RenderTreeNode.type` to a `Postprocess` that does
|
|
339
384
|
# postprocessing for the output of the `Render` function. Unlike
|
|
@@ -342,7 +387,7 @@ normalize_list = partial(
|
|
|
342
387
|
# will run in series.
|
|
343
388
|
POSTPROCESSORS: Mapping[str, Postprocess] = {
|
|
344
389
|
"bullet_list": normalize_list,
|
|
345
|
-
"inline":
|
|
390
|
+
"inline": postprocess_inline,
|
|
346
391
|
"ordered_list": normalize_list,
|
|
347
392
|
"paragraph": escape_deflist,
|
|
348
393
|
}
|
|
@@ -25,7 +25,7 @@ license-files = ["LICENSE"]
|
|
|
25
25
|
name = "mdformat_mkdocs"
|
|
26
26
|
readme = "README.md"
|
|
27
27
|
requires-python = ">=3.10.0"
|
|
28
|
-
version = "5.
|
|
28
|
+
version = "5.2.0b0"
|
|
29
29
|
|
|
30
30
|
[project.entry-points."mdformat.parser_extension"]
|
|
31
31
|
mkdocs = "mdformat_mkdocs"
|
|
@@ -69,7 +69,7 @@ homepage = "https://github.com/kyleking/mdformat-mkdocs"
|
|
|
69
69
|
|
|
70
70
|
[tool.commitizen]
|
|
71
71
|
tag_format = "v${version}"
|
|
72
|
-
version = "5.
|
|
72
|
+
version = "5.2.0b0"
|
|
73
73
|
version_files = ["mdformat_mkdocs/__init__.py", "pyproject.toml:^version"]
|
|
74
74
|
|
|
75
75
|
[tool.mypy]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/_synced/admon_factories/README.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/mdit_plugins/_material_admon.py
RENAMED
|
File without changes
|
|
File without changes
|
{mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/mdit_plugins/_material_deflist.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/mdit_plugins/_pymd_admon.py
RENAMED
|
File without changes
|
{mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/mdit_plugins/_pymd_arithmatex.py
RENAMED
|
File without changes
|
{mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/mdit_plugins/_pymd_captions.py
RENAMED
|
File without changes
|
{mdformat_mkdocs-5.1.4 → mdformat_mkdocs-5.2.0b0}/mdformat_mkdocs/mdit_plugins/_pymd_snippet.py
RENAMED
|
File without changes
|
|
File without changes
|