markdown-include-variants 0.0.2__tar.gz → 0.0.3__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.
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/PKG-INFO +1 -1
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/release-notes.md +6 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/src/markdown_include_variants/_main.py +16 -8
- markdown_include_variants-0.0.3/src/markdown_include_variants/_version.py +1 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/tests/test_all_variants.py +4 -4
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/tests/test_simple_ln_hl.py +11 -11
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/tests/test_up_to_py39.py +1 -1
- markdown_include_variants-0.0.2/src/markdown_include_variants/_version.py +0 -1
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/.github/DISCUSSION_TEMPLATE/questions.yml +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/.github/FUNDING.yml +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/.github/ISSUE_TEMPLATE/privileged.yml +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/.github/dependabot.yml +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/.github/labeler.yml +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/.github/workflows/issue-manager.yml +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/.github/workflows/labeler.yml +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/.github/workflows/latest-changes.yml +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/.github/workflows/publish.yml +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/.github/workflows/smokeshow.yml +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/.github/workflows/test.yml +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/.gitignore +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/.pre-commit-config.yaml +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/.python-version +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/CITATION.cff +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/LICENSE +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/README.md +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/all_variants/tutorial001.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/all_variants/tutorial001_an.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/all_variants/tutorial001_an_py310.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/all_variants/tutorial001_an_py39.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/all_variants/tutorial001_py310.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/all_variants/tutorial001_py39.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/no_py39/tutorial001.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/no_py39/tutorial001_an.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/no_py39/tutorial001_an_py310.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/no_py39/tutorial001_py310.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/only_py310/tutorial001_an_py310.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/only_py310/tutorial001_py310.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/only_py_no_an/tutorial001.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/only_py_no_an/tutorial001_py310.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/only_py_no_an/tutorial001_py39.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/simple/tutorial001.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/up_to_py39/tutorial001.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/up_to_py39/tutorial001_an.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/up_to_py39/tutorial001_an_py39.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/up_to_py39/tutorial001_py39.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/pyproject.toml +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/scripts/format.sh +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/scripts/lint.sh +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/scripts/test.sh +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/src/markdown_include_variants/__init__.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/src/markdown_include_variants/py.typed +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/tests/test_another_preferred_variant.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/tests/test_no_py39.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/tests/test_only_py310.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/tests/test_only_py_no_an.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/tests/test_simple_hl.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/tests/test_simple_ln.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/tests/test_simple_no_configs.py +0 -0
- {markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: markdown-include-variants
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: Markdown extension to expand directives to include source example files to also include their variants. Only useful to tiangolo's projets. Don't use it. 😅
|
|
5
5
|
Project-URL: Homepage, https://github.com/tiangolo/markdown-include-variants
|
|
6
6
|
Project-URL: Repository, https://github.com/tiangolo/markdown-include-variants
|
|
@@ -167,6 +167,16 @@ def calculate_includes(
|
|
|
167
167
|
return lines_groups
|
|
168
168
|
|
|
169
169
|
|
|
170
|
+
def generate_hl_string(hl_lines: list[tuple[int, int]]) -> str:
|
|
171
|
+
hl_lines_strs: list[str] = []
|
|
172
|
+
for hl_line in hl_lines:
|
|
173
|
+
if hl_line[0] == hl_line[1]:
|
|
174
|
+
hl_lines_strs.append(str(hl_line[0]))
|
|
175
|
+
else:
|
|
176
|
+
hl_lines_strs.append(f"{hl_line[0]}-{hl_line[1]}")
|
|
177
|
+
return " ".join(hl_lines_strs)
|
|
178
|
+
|
|
179
|
+
|
|
170
180
|
re_line = r"^\{\*\s*(\S+)\s*(.*)\*\}$"
|
|
171
181
|
re_config = r"(\w+)\[([^\]]+)\]"
|
|
172
182
|
|
|
@@ -203,13 +213,7 @@ class IncludeVariantsPreprocessor(Preprocessor):
|
|
|
203
213
|
use_hl_lines.extend(info.computed_hl_lines())
|
|
204
214
|
else:
|
|
205
215
|
use_hl_lines = highlight_lines
|
|
206
|
-
|
|
207
|
-
for hl_line in use_hl_lines:
|
|
208
|
-
if hl_line[0] == hl_line[1]:
|
|
209
|
-
use_hl_lines_strs.append(str(hl_line[0]))
|
|
210
|
-
else:
|
|
211
|
-
use_hl_lines_strs.append(f"{hl_line[0]}-{hl_line[1]}")
|
|
212
|
-
use_hl_lines_str = " ".join(use_hl_lines_strs)
|
|
216
|
+
use_hl_lines_str = generate_hl_string(use_hl_lines)
|
|
213
217
|
|
|
214
218
|
variants = calculate_variants(base_path)
|
|
215
219
|
if len(variants) == 0:
|
|
@@ -275,11 +279,15 @@ class IncludeVariantsPreprocessor(Preprocessor):
|
|
|
275
279
|
]
|
|
276
280
|
)
|
|
277
281
|
if include_lines:
|
|
282
|
+
first_line_full = "```python"
|
|
283
|
+
if highlight_lines:
|
|
284
|
+
hl_lines_full_str = generate_hl_string(highlight_lines)
|
|
285
|
+
first_line_full += f' hl_lines="{hl_lines_full_str}"'
|
|
278
286
|
block_lines.extend(
|
|
279
287
|
[
|
|
280
288
|
"//// details | 👀 Full file preview",
|
|
281
289
|
"",
|
|
282
|
-
|
|
290
|
+
first_line_full,
|
|
283
291
|
f"{{!{preferred_variant.path}!}}",
|
|
284
292
|
"```",
|
|
285
293
|
"",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.3"
|
{markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/tests/test_all_variants.py
RENAMED
|
@@ -79,7 +79,7 @@ def test_all_variants_ln_hl():
|
|
|
79
79
|
<p>```</p>
|
|
80
80
|
<p>////</p>
|
|
81
81
|
<p>//// details | 👀 Full file preview</p>
|
|
82
|
-
<p><code>python
|
|
82
|
+
<p><code>python hl_lines="4-5"
|
|
83
83
|
{!docs_src/all_variants/tutorial001_an_py310.py!}</code></p>
|
|
84
84
|
<p>////</p>
|
|
85
85
|
<p>///// details | 🤓 Other versions and variants</p>
|
|
@@ -151,9 +151,9 @@ def test_all_variants_ln_hl_include():
|
|
|
151
151
|
<div class="highlight"><pre><span></span><code><span class="nb">print</span><span class="p">(</span><span class="s2">"an py310 line 1"</span><span class="p">)</span>
|
|
152
152
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"an py310 line 2"</span><span class="p">)</span>
|
|
153
153
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"an py310 line 3"</span><span class="p">)</span>
|
|
154
|
-
<span class="nb">print</span><span class="p">(</span><span class="s2">"an py310 line 4"</span><span class="p">)</span>
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
<span class="hll"><span class="nb">print</span><span class="p">(</span><span class="s2">"an py310 line 4"</span><span class="p">)</span>
|
|
155
|
+
</span><span class="hll"><span class="nb">print</span><span class="p">(</span><span class="s2">"an py310 line 5"</span><span class="p">)</span>
|
|
156
|
+
</span><span class="nb">print</span><span class="p">(</span><span class="s2">"an py310 line 6"</span><span class="p">)</span>
|
|
157
157
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"an py310 line 7"</span><span class="p">)</span>
|
|
158
158
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"an py310 line 8"</span><span class="p">)</span>
|
|
159
159
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"an py310 line 9"</span><span class="p">)</span>
|
{markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/tests/test_simple_ln_hl.py
RENAMED
|
@@ -32,7 +32,7 @@ def test_simple_ln_hl():
|
|
|
32
32
|
<p>```</p>
|
|
33
33
|
<p>////</p>
|
|
34
34
|
<p>//// details | 👀 Full file preview</p>
|
|
35
|
-
<p><code>python
|
|
35
|
+
<p><code>python hl_lines="1-3"
|
|
36
36
|
{!docs_src/simple/tutorial001.py!}</code></p>
|
|
37
37
|
<p>////</p>
|
|
38
38
|
"""
|
|
@@ -64,7 +64,7 @@ def test_simple_ln_hl_middle_block():
|
|
|
64
64
|
<p>```</p>
|
|
65
65
|
<p>////</p>
|
|
66
66
|
<p>//// details | 👀 Full file preview</p>
|
|
67
|
-
<p><code>python
|
|
67
|
+
<p><code>python hl_lines="2-3"
|
|
68
68
|
{!docs_src/simple/tutorial001.py!}</code></p>
|
|
69
69
|
<p>////</p>
|
|
70
70
|
"""
|
|
@@ -97,7 +97,7 @@ def test_simple_ln_hl_middle_block_end_block():
|
|
|
97
97
|
```</p>
|
|
98
98
|
<p>////</p>
|
|
99
99
|
<p>//// details | 👀 Full file preview</p>
|
|
100
|
-
<p><code>python
|
|
100
|
+
<p><code>python hl_lines="2-3 8-10"
|
|
101
101
|
{!docs_src/simple/tutorial001.py!}</code></p>
|
|
102
102
|
<p>////</p>
|
|
103
103
|
"""
|
|
@@ -132,7 +132,7 @@ def test_simple_ln_hl_middle_block_middle_block_end_block():
|
|
|
132
132
|
```</p>
|
|
133
133
|
<p>////</p>
|
|
134
134
|
<p>//// details | 👀 Full file preview</p>
|
|
135
|
-
<p><code>python
|
|
135
|
+
<p><code>python hl_lines="2-3 5-6 8-10"
|
|
136
136
|
{!docs_src/simple/tutorial001.py!}</code></p>
|
|
137
137
|
<p>////</p>
|
|
138
138
|
"""
|
|
@@ -167,7 +167,7 @@ def test_simple_ln_hl_middle_middle_block_end():
|
|
|
167
167
|
```</p>
|
|
168
168
|
<p>////</p>
|
|
169
169
|
<p>//// details | 👀 Full file preview</p>
|
|
170
|
-
<p><code>python
|
|
170
|
+
<p><code>python hl_lines="2 5-6 10"
|
|
171
171
|
{!docs_src/simple/tutorial001.py!}</code></p>
|
|
172
172
|
<p>////</p>
|
|
173
173
|
"""
|
|
@@ -201,7 +201,7 @@ def test_simple_ln_hl_first_middle_end():
|
|
|
201
201
|
```</p>
|
|
202
202
|
<p>////</p>
|
|
203
203
|
<p>//// details | 👀 Full file preview</p>
|
|
204
|
-
<p><code>python
|
|
204
|
+
<p><code>python hl_lines="1 6-8 10"
|
|
205
205
|
{!docs_src/simple/tutorial001.py!}</code></p>
|
|
206
206
|
<p>////</p>
|
|
207
207
|
"""
|
|
@@ -234,7 +234,7 @@ def test_simple_ln_hl_middle_block_end_block_hl_middle_block():
|
|
|
234
234
|
```</p>
|
|
235
235
|
<p>////</p>
|
|
236
236
|
<p>//// details | 👀 Full file preview</p>
|
|
237
|
-
<p><code>python
|
|
237
|
+
<p><code>python hl_lines="2"
|
|
238
238
|
{!docs_src/simple/tutorial001.py!}</code></p>
|
|
239
239
|
<p>////</p>
|
|
240
240
|
"""
|
|
@@ -267,7 +267,7 @@ def test_simple_ln_hl_middle_block_end_block_hl_end_block():
|
|
|
267
267
|
```</p>
|
|
268
268
|
<p>////</p>
|
|
269
269
|
<p>//// details | 👀 Full file preview</p>
|
|
270
|
-
<p><code>python
|
|
270
|
+
<p><code>python hl_lines="8-9"
|
|
271
271
|
{!docs_src/simple/tutorial001.py!}</code></p>
|
|
272
272
|
<p>////</p>
|
|
273
273
|
"""
|
|
@@ -316,9 +316,9 @@ def test_simple_ln_hl_middle_block_end_block_hl_end_block_include():
|
|
|
316
316
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"simple line 5"</span><span class="p">)</span>
|
|
317
317
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"simple line 6"</span><span class="p">)</span>
|
|
318
318
|
<span class="nb">print</span><span class="p">(</span><span class="s2">"simple line 7"</span><span class="p">)</span>
|
|
319
|
-
<span class="nb">print</span><span class="p">(</span><span class="s2">"simple line 8"</span><span class="p">)</span>
|
|
320
|
-
|
|
321
|
-
|
|
319
|
+
<span class="hll"><span class="nb">print</span><span class="p">(</span><span class="s2">"simple line 8"</span><span class="p">)</span>
|
|
320
|
+
</span><span class="hll"><span class="nb">print</span><span class="p">(</span><span class="s2">"simple line 9"</span><span class="p">)</span>
|
|
321
|
+
</span><span class="nb">print</span><span class="p">(</span><span class="s2">"simple line 10"</span><span class="p">)</span>
|
|
322
322
|
</code></pre></div>
|
|
323
323
|
<p>////</p>
|
|
324
324
|
"""
|
{markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/tests/test_up_to_py39.py
RENAMED
|
@@ -65,7 +65,7 @@ def test_all_variants_ln_hl():
|
|
|
65
65
|
<p>```</p>
|
|
66
66
|
<p>////</p>
|
|
67
67
|
<p>//// details | 👀 Full file preview</p>
|
|
68
|
-
<p><code>python
|
|
68
|
+
<p><code>python hl_lines="4-5"
|
|
69
69
|
{!docs_src/up_to_py39/tutorial001_an_py39.py!}</code></p>
|
|
70
70
|
<p>////</p>
|
|
71
71
|
<p>///// details | 🤓 Other versions and variants</p>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.0.2"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/.github/workflows/labeler.yml
RENAMED
|
File without changes
|
|
File without changes
|
{markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/.github/workflows/publish.yml
RENAMED
|
File without changes
|
{markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/.github/workflows/smokeshow.yml
RENAMED
|
File without changes
|
{markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/.github/workflows/test.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/no_py39/tutorial001.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/docs_src/simple/tutorial001.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/tests/test_only_py310.py
RENAMED
|
File without changes
|
{markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/tests/test_only_py_no_an.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{markdown_include_variants-0.0.2 → markdown_include_variants-0.0.3}/tests/test_simple_no_configs.py
RENAMED
|
File without changes
|
|
File without changes
|