markdown-include-variants 0.0.9__tar.gz → 0.0.10__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.9 → markdown_include_variants-0.0.10}/PKG-INFO +49 -13
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/README.md +48 -12
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/release-notes.md +6 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/src/markdown_include_variants/_main.py +123 -226
- markdown_include_variants-0.0.10/src/markdown_include_variants/_version.py +1 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/tests/test_all_variants.py +14 -14
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/tests/test_all_variants_folder.py +8 -8
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/tests/test_another_preferred_variant.py +2 -2
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/tests/test_no_py39.py +2 -2
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/tests/test_only_preview.py +0 -2
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/tests/test_only_py_no_an.py +1 -1
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/tests/test_simple_hl.py +5 -15
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/tests/test_simple_ln.py +15 -75
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/tests/test_simple_ln_hl.py +9 -45
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/tests/test_simple_no_configs.py +4 -12
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/tests/test_simple_title.py +2 -6
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/tests/test_up_to_py39.py +6 -6
- markdown_include_variants-0.0.10/tests/test_variant_discovery.py +350 -0
- markdown_include_variants-0.0.9/src/markdown_include_variants/_version.py +0 -1
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/.github/dependabot.yml +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/.github/latest-changes.yml +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/.github/pr-push.yml +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/.github/pr-submit.yml +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/.github/workflows/bump-pre-commit-hooks.yml +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/.github/workflows/create-draft-release.yml +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/.github/workflows/issue-manager.yml +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/.github/workflows/pre-commit.yml +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/.github/workflows/prepare-release.yml +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/.github/workflows/publish.yml +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/.github/workflows/smokeshow.yml +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/.github/workflows/test.yml +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/.github/workflows/zizmor.yml +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/.gitignore +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/.pre-commit-config.yaml +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/.python-version +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/CITATION.cff +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/LICENSE +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/all_variants/tutorial001_an_py310.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/all_variants/tutorial001_an_py311.py +0 -0
- /markdown_include_variants-0.0.9/docs_src/all_variants/tutorial001_an.py → /markdown_include_variants-0.0.10/docs_src/all_variants/tutorial001_an_py38.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/all_variants/tutorial001_an_py39.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/all_variants/tutorial001_py310.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/all_variants/tutorial001_py311.py +0 -0
- /markdown_include_variants-0.0.9/docs_src/all_variants/tutorial001.py → /markdown_include_variants-0.0.10/docs_src/all_variants/tutorial001_py38.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/all_variants/tutorial001_py39.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/all_variants_folder/app_an_py310/tutorial001.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/all_variants_folder/app_an_py311/tutorial001.py +0 -0
- {markdown_include_variants-0.0.9/docs_src/all_variants_folder/app_an → markdown_include_variants-0.0.10/docs_src/all_variants_folder/app_an_py38}/tutorial001.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/all_variants_folder/app_an_py39/tutorial001.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/all_variants_folder/app_py310/tutorial001.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/all_variants_folder/app_py311/tutorial001.py +0 -0
- {markdown_include_variants-0.0.9/docs_src/all_variants_folder/app → markdown_include_variants-0.0.10/docs_src/all_variants_folder/app_py38}/tutorial001.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/all_variants_folder/app_py39/tutorial001.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/no_py39/tutorial001_an_py310.py +0 -0
- /markdown_include_variants-0.0.9/docs_src/no_py39/tutorial001_an.py → /markdown_include_variants-0.0.10/docs_src/no_py39/tutorial001_an_py38.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/no_py39/tutorial001_py310.py +0 -0
- /markdown_include_variants-0.0.9/docs_src/no_py39/tutorial001.py → /markdown_include_variants-0.0.10/docs_src/no_py39/tutorial001_py38.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/only_py310/tutorial001_an_py310.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/only_py310/tutorial001_py310.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/only_py310_no_an_folder/app_py310/tutorial001.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/only_py_no_an/tutorial001_py310.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/only_py_no_an/tutorial001_py311.py +0 -0
- /markdown_include_variants-0.0.9/docs_src/only_py_no_an/tutorial001.py → /markdown_include_variants-0.0.10/docs_src/only_py_no_an/tutorial001_py38.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/only_py_no_an/tutorial001_py39.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/simple/tutorial001.py +0 -0
- /markdown_include_variants-0.0.9/docs_src/up_to_py39/tutorial001_an.py → /markdown_include_variants-0.0.10/docs_src/up_to_py39/tutorial001_an_py38.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/up_to_py39/tutorial001_an_py39.py +0 -0
- /markdown_include_variants-0.0.9/docs_src/up_to_py39/tutorial001.py → /markdown_include_variants-0.0.10/docs_src/up_to_py39/tutorial001_py38.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/docs_src/up_to_py39/tutorial001_py39.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/pyproject.toml +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/scripts/add_latest_release_date.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/scripts/format.sh +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/scripts/lint.sh +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/scripts/prepare_release.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/scripts/test.sh +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/src/markdown_include_variants/__init__.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/src/markdown_include_variants/py.typed +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/tests/test_only_py310.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/tests/test_only_py310_no_an_folder.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/tests/test_prepare_release.py +0 -0
- {markdown_include_variants-0.0.9 → markdown_include_variants-0.0.10}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: markdown-include-variants
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.10
|
|
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
|
|
@@ -71,23 +71,44 @@ The other configs are for the extensions that actually render the output, this e
|
|
|
71
71
|
|
|
72
72
|
### Workflow
|
|
73
73
|
|
|
74
|
-
* You add a Python source example to the `docs_src` directory, with the minimum Python version supported by the project, and using
|
|
75
|
-
*
|
|
76
|
-
*
|
|
74
|
+
* You add a Python source example to the `docs_src` directory, with the minimum Python version supported by the project, and using `Annotated` where applicable, named something like `tutorial001.py`.
|
|
75
|
+
* If a non-Annotated alternative is useful, copy the file and name it with the suffix `_non_an`, like: `tutorial001_non_an.py`.
|
|
76
|
+
* If an example needs alternatives for different Python versions, give every variant an explicit Python version suffix, like `tutorial001_py311.py`, `tutorial001_py312.py`, and `tutorial001_non_an_py312.py`.
|
|
77
77
|
* In the Markdown file, include the preferred version of the file, using this syntax:
|
|
78
78
|
|
|
79
79
|
```markdown
|
|
80
|
-
{* ./docs_src/first_steps/
|
|
80
|
+
{* ./docs_src/first_steps/tutorial001.py *}
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
That will be automatically expanded with [mdx-include](https://github.com/neurobin/mdx_include) to include the other variants below in a collapsed `details` box.
|
|
84
84
|
|
|
85
|
+
### Variant Names
|
|
86
|
+
|
|
87
|
+
| Filename | Display |
|
|
88
|
+
| --- | --- |
|
|
89
|
+
| `tutorial001.py` | Code block |
|
|
90
|
+
| `tutorial001_non_an.py` | non-Annotated |
|
|
91
|
+
| `tutorial001_py312.py` | Python 3.12+ |
|
|
92
|
+
| `tutorial001_non_an_py312.py` | Python 3.12+ - non-Annotated |
|
|
93
|
+
|
|
94
|
+
Examples without a version suffix target the project's supported Python versions. An explicit version suffix keeps its label even for a single file. Every variant of the same example must either have a Python version suffix or be unversioned.
|
|
95
|
+
|
|
96
|
+
### Directory Variants
|
|
97
|
+
|
|
98
|
+
For examples spanning multiple files, use the same suffixes on directories, such as `app` and `app_non_an`:
|
|
99
|
+
|
|
100
|
+
```markdown
|
|
101
|
+
{* ./docs_src/bigger_applications/app/routers/items.py title["app/routers/items.py"] *}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The extension finds the same relative file in each directory variant, including nested files. Use `title` to display a filename above the code block.
|
|
105
|
+
|
|
85
106
|
### Include Lines
|
|
86
107
|
|
|
87
108
|
To include specific line ranges, use the config `ln`:
|
|
88
109
|
|
|
89
110
|
```markdown
|
|
90
|
-
{* ./docs_src/first_steps/
|
|
111
|
+
{* ./docs_src/first_steps/tutorial001.py ln[3:6,8,10:11] *}
|
|
91
112
|
```
|
|
92
113
|
|
|
93
114
|
That will include only:
|
|
@@ -109,7 +130,7 @@ If you include specific lines, it will also add another collapsed `details` box
|
|
|
109
130
|
You can highlight specific lines using the config `hl`:
|
|
110
131
|
|
|
111
132
|
```markdown
|
|
112
|
-
{* ./docs_src/first_steps/
|
|
133
|
+
{* ./docs_src/first_steps/tutorial001.py hl[3,5:7,10] *}
|
|
113
134
|
```
|
|
114
135
|
|
|
115
136
|
That will highlight:
|
|
@@ -118,19 +139,19 @@ That will highlight:
|
|
|
118
139
|
* lines 5 to 7
|
|
119
140
|
* line 10
|
|
120
141
|
|
|
121
|
-
Have in mind that the
|
|
142
|
+
Have in mind that the main file shown will be the one named in the include, and the highlights will apply to that file.
|
|
122
143
|
|
|
123
|
-
So, when deciding which lines to highlight, do that based on the
|
|
144
|
+
So, when deciding which lines to highlight, do that based on the file you include.
|
|
124
145
|
|
|
125
146
|
### Include Lines and Highlight
|
|
126
147
|
|
|
127
148
|
You can combine both `ln` and `hl`:
|
|
128
149
|
|
|
129
150
|
```markdown
|
|
130
|
-
{* ./docs_src/first_steps/
|
|
151
|
+
{* ./docs_src/first_steps/tutorial001.py ln[3:6,8,10:11] hl[3,5:6,10] *}
|
|
131
152
|
```
|
|
132
153
|
|
|
133
|
-
The highlighted lines refer to the source file (for the
|
|
154
|
+
The highlighted lines refer to the source file (for the included version), not the final rendered code block.
|
|
134
155
|
|
|
135
156
|
This makes it easier to decide which lines to highlight just by opening the source file, without having to calculate the actual lines in the rendered block after included, the extra lines for comments when omitting lines, etc.
|
|
136
157
|
|
|
@@ -151,7 +172,7 @@ print("line 7")
|
|
|
151
172
|
Using a declaration like this:
|
|
152
173
|
|
|
153
174
|
```markdown
|
|
154
|
-
{* ./docs_src/first_steps/
|
|
175
|
+
{* ./docs_src/first_steps/tutorial001.py ln[5:7] hl[6] *}
|
|
155
176
|
```
|
|
156
177
|
|
|
157
178
|
Could render something like:
|
|
@@ -171,11 +192,26 @@ Notice that the comment above adds 2 extra lines, and only the desired lines are
|
|
|
171
192
|
If you only want to generate the "File Preview" collapsed details section, without actually including a tab of source files, you can use `ln[0]`:
|
|
172
193
|
|
|
173
194
|
```markdown
|
|
174
|
-
{* ./docs_src/first_steps/
|
|
195
|
+
{* ./docs_src/first_steps/tutorial001.py ln[0] *}
|
|
175
196
|
```
|
|
176
197
|
|
|
177
198
|
This is useful for example at the beginning of a new page, in a recap of the last used file in the previous page.
|
|
178
199
|
|
|
200
|
+
### Migrating Existing Examples
|
|
201
|
+
|
|
202
|
+
Legacy `_an` names still work: `tutorial001_an.py` is recommended and its bare counterpart, `tutorial001.py`, is non-Annotated. This also applies to directory variants and pairs with matching Python versions.
|
|
203
|
+
|
|
204
|
+
Rename both sides of a pair together:
|
|
205
|
+
|
|
206
|
+
| Existing filename | New filename |
|
|
207
|
+
| --- | --- |
|
|
208
|
+
| `tutorial001_py310.py` | `tutorial001_non_an.py` |
|
|
209
|
+
| `tutorial001_an_py310.py` | `tutorial001.py` |
|
|
210
|
+
|
|
211
|
+
Keep explicit versions where alternatives still need them. Use `_py38` for files previously relying on the implicit Python 3.8 version.
|
|
212
|
+
|
|
213
|
+
Update includes, test imports, configuration, and scripts to match. Each example family must use either the legacy `_an` convention or the new `_non_an` convention.
|
|
214
|
+
|
|
179
215
|
## License
|
|
180
216
|
|
|
181
217
|
This project is licensed under the terms of the [MIT license](https://github.com/tiangolo/markdown-include-variants/blob/main/LICENSE).
|
|
@@ -54,23 +54,44 @@ The other configs are for the extensions that actually render the output, this e
|
|
|
54
54
|
|
|
55
55
|
### Workflow
|
|
56
56
|
|
|
57
|
-
* You add a Python source example to the `docs_src` directory, with the minimum Python version supported by the project, and using
|
|
58
|
-
*
|
|
59
|
-
*
|
|
57
|
+
* You add a Python source example to the `docs_src` directory, with the minimum Python version supported by the project, and using `Annotated` where applicable, named something like `tutorial001.py`.
|
|
58
|
+
* If a non-Annotated alternative is useful, copy the file and name it with the suffix `_non_an`, like: `tutorial001_non_an.py`.
|
|
59
|
+
* If an example needs alternatives for different Python versions, give every variant an explicit Python version suffix, like `tutorial001_py311.py`, `tutorial001_py312.py`, and `tutorial001_non_an_py312.py`.
|
|
60
60
|
* In the Markdown file, include the preferred version of the file, using this syntax:
|
|
61
61
|
|
|
62
62
|
```markdown
|
|
63
|
-
{* ./docs_src/first_steps/
|
|
63
|
+
{* ./docs_src/first_steps/tutorial001.py *}
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
That will be automatically expanded with [mdx-include](https://github.com/neurobin/mdx_include) to include the other variants below in a collapsed `details` box.
|
|
67
67
|
|
|
68
|
+
### Variant Names
|
|
69
|
+
|
|
70
|
+
| Filename | Display |
|
|
71
|
+
| --- | --- |
|
|
72
|
+
| `tutorial001.py` | Code block |
|
|
73
|
+
| `tutorial001_non_an.py` | non-Annotated |
|
|
74
|
+
| `tutorial001_py312.py` | Python 3.12+ |
|
|
75
|
+
| `tutorial001_non_an_py312.py` | Python 3.12+ - non-Annotated |
|
|
76
|
+
|
|
77
|
+
Examples without a version suffix target the project's supported Python versions. An explicit version suffix keeps its label even for a single file. Every variant of the same example must either have a Python version suffix or be unversioned.
|
|
78
|
+
|
|
79
|
+
### Directory Variants
|
|
80
|
+
|
|
81
|
+
For examples spanning multiple files, use the same suffixes on directories, such as `app` and `app_non_an`:
|
|
82
|
+
|
|
83
|
+
```markdown
|
|
84
|
+
{* ./docs_src/bigger_applications/app/routers/items.py title["app/routers/items.py"] *}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The extension finds the same relative file in each directory variant, including nested files. Use `title` to display a filename above the code block.
|
|
88
|
+
|
|
68
89
|
### Include Lines
|
|
69
90
|
|
|
70
91
|
To include specific line ranges, use the config `ln`:
|
|
71
92
|
|
|
72
93
|
```markdown
|
|
73
|
-
{* ./docs_src/first_steps/
|
|
94
|
+
{* ./docs_src/first_steps/tutorial001.py ln[3:6,8,10:11] *}
|
|
74
95
|
```
|
|
75
96
|
|
|
76
97
|
That will include only:
|
|
@@ -92,7 +113,7 @@ If you include specific lines, it will also add another collapsed `details` box
|
|
|
92
113
|
You can highlight specific lines using the config `hl`:
|
|
93
114
|
|
|
94
115
|
```markdown
|
|
95
|
-
{* ./docs_src/first_steps/
|
|
116
|
+
{* ./docs_src/first_steps/tutorial001.py hl[3,5:7,10] *}
|
|
96
117
|
```
|
|
97
118
|
|
|
98
119
|
That will highlight:
|
|
@@ -101,19 +122,19 @@ That will highlight:
|
|
|
101
122
|
* lines 5 to 7
|
|
102
123
|
* line 10
|
|
103
124
|
|
|
104
|
-
Have in mind that the
|
|
125
|
+
Have in mind that the main file shown will be the one named in the include, and the highlights will apply to that file.
|
|
105
126
|
|
|
106
|
-
So, when deciding which lines to highlight, do that based on the
|
|
127
|
+
So, when deciding which lines to highlight, do that based on the file you include.
|
|
107
128
|
|
|
108
129
|
### Include Lines and Highlight
|
|
109
130
|
|
|
110
131
|
You can combine both `ln` and `hl`:
|
|
111
132
|
|
|
112
133
|
```markdown
|
|
113
|
-
{* ./docs_src/first_steps/
|
|
134
|
+
{* ./docs_src/first_steps/tutorial001.py ln[3:6,8,10:11] hl[3,5:6,10] *}
|
|
114
135
|
```
|
|
115
136
|
|
|
116
|
-
The highlighted lines refer to the source file (for the
|
|
137
|
+
The highlighted lines refer to the source file (for the included version), not the final rendered code block.
|
|
117
138
|
|
|
118
139
|
This makes it easier to decide which lines to highlight just by opening the source file, without having to calculate the actual lines in the rendered block after included, the extra lines for comments when omitting lines, etc.
|
|
119
140
|
|
|
@@ -134,7 +155,7 @@ print("line 7")
|
|
|
134
155
|
Using a declaration like this:
|
|
135
156
|
|
|
136
157
|
```markdown
|
|
137
|
-
{* ./docs_src/first_steps/
|
|
158
|
+
{* ./docs_src/first_steps/tutorial001.py ln[5:7] hl[6] *}
|
|
138
159
|
```
|
|
139
160
|
|
|
140
161
|
Could render something like:
|
|
@@ -154,11 +175,26 @@ Notice that the comment above adds 2 extra lines, and only the desired lines are
|
|
|
154
175
|
If you only want to generate the "File Preview" collapsed details section, without actually including a tab of source files, you can use `ln[0]`:
|
|
155
176
|
|
|
156
177
|
```markdown
|
|
157
|
-
{* ./docs_src/first_steps/
|
|
178
|
+
{* ./docs_src/first_steps/tutorial001.py ln[0] *}
|
|
158
179
|
```
|
|
159
180
|
|
|
160
181
|
This is useful for example at the beginning of a new page, in a recap of the last used file in the previous page.
|
|
161
182
|
|
|
183
|
+
### Migrating Existing Examples
|
|
184
|
+
|
|
185
|
+
Legacy `_an` names still work: `tutorial001_an.py` is recommended and its bare counterpart, `tutorial001.py`, is non-Annotated. This also applies to directory variants and pairs with matching Python versions.
|
|
186
|
+
|
|
187
|
+
Rename both sides of a pair together:
|
|
188
|
+
|
|
189
|
+
| Existing filename | New filename |
|
|
190
|
+
| --- | --- |
|
|
191
|
+
| `tutorial001_py310.py` | `tutorial001_non_an.py` |
|
|
192
|
+
| `tutorial001_an_py310.py` | `tutorial001.py` |
|
|
193
|
+
|
|
194
|
+
Keep explicit versions where alternatives still need them. Use `_py38` for files previously relying on the implicit Python 3.8 version.
|
|
195
|
+
|
|
196
|
+
Update includes, test imports, configuration, and scripts to match. Each example family must use either the legacy `_an` convention or the new `_non_an` convention.
|
|
197
|
+
|
|
162
198
|
## License
|
|
163
199
|
|
|
164
200
|
This project is licensed under the terms of the [MIT license](https://github.com/tiangolo/markdown-include-variants/blob/main/LICENSE).
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## Latest Changes
|
|
4
4
|
|
|
5
|
+
## 0.0.10 (2026-11-08)
|
|
6
|
+
|
|
7
|
+
### Breaking Changes
|
|
8
|
+
|
|
9
|
+
* ✨ Add unversioned snippets and `_non_an` variants. PR [#115](https://github.com/tiangolo/markdown-include-variants/pull/115) by [@tiangolo](https://github.com/tiangolo).
|
|
10
|
+
|
|
5
11
|
## 0.0.9 (2026-11-08)
|
|
6
12
|
|
|
7
13
|
### Breaking Changes
|