Skip to content

Commit 3ba9103

Browse files
committed
Eliminate use of the include-markdown plugin for MkDocs
Replace it's use with simply refactoring some of the documentaiton and also using the pymdown.snippets extension which is more reliably supported by MkDocs. This is based in part on real-world problems encountered using the include-markdown problem with various other plugins and with migrating to Zensical.
1 parent 133c0e6 commit 3ba9103

File tree

5 files changed

+37
-50
lines changed

5 files changed

+37
-50
lines changed

.github/CONTRIBUTING.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,19 @@ for a list of dependencies needed for building `cmd2`.
9393
See the `dev` list under the `[dependency-groups]` heading in [pyproject.toml](../pyproject.toml)
9494
for a list of dependencies needed for building `cmd2`.
9595

96-
| Prerequisite | Minimum Version | Purpose |
97-
| ------------------------------------------------------------------------------------------ | --------------- | -------------------------------- |
98-
| [codecov](http://doc.pytest.org/en/latest/) | `2.1.13` | Cover coverage reporting |
99-
| [invoke](https://www.pyinvoke.org/) | `2.2.0` | Command automation |
100-
| [mypy](https://mypy-lang.org/) | `1.13.0` | Static type checker |
101-
| [pytest](https://docs.pytest.org/en/stable/) | `3.0.6` | Unit and integration tests |
102-
| [pytest-cov](http://doc.pytest.org/en/latest/) | `6.0.0` | Pytest code coverage |
103-
| [pytest-mock](https://pypi.org/project/pytest-mock/) | `3.14.0` | Pytest mocker fixture |
104-
| [mkdocs-include-markdown-plugin](https://pypi.org/project/mkdocs-include-markdown-plugin/) | `7.1.2` | MkDocs Plugin include MkDn |
105-
| [mkdocs-macros-plugin](https://mkdocs-macros-plugin.readthedocs.io/) | `1.3.7` | MkDocs Plugin for macros |
106-
| [mkdocs-material](https://squidfunk.github.io/mkdocs-material/) | `9.5.49` | Documentation |
107-
| [mkdocstrings[python]](https://mkdocstrings.github.io/) | `0.27.0` | MkDocs Plugin for Python AutoDoc |
108-
| [ruff](https://github.com/astral-sh/ruff) | `0.7.3` | Fast linter and formatter |
109-
| [uv](https://github.com/astral-sh/uv) | `0.5.1` | Python package management |
96+
| Prerequisite | Minimum Version | Purpose |
97+
| -------------------------------------------------------------------- | --------------- | -------------------------------- |
98+
| [codecov](http://doc.pytest.org/en/latest/) | `2.1.13` | Cover coverage reporting |
99+
| [invoke](https://www.pyinvoke.org/) | `2.2.0` | Command automation |
100+
| [mypy](https://mypy-lang.org/) | `1.13.0` | Static type checker |
101+
| [pytest](https://docs.pytest.org/en/stable/) | `3.0.6` | Unit and integration tests |
102+
| [pytest-cov](http://doc.pytest.org/en/latest/) | `6.0.0` | Pytest code coverage |
103+
| [pytest-mock](https://pypi.org/project/pytest-mock/) | `3.14.0` | Pytest mocker fixture |
104+
| [mkdocs-macros-plugin](https://mkdocs-macros-plugin.readthedocs.io/) | `1.3.7` | MkDocs Plugin for macros |
105+
| [mkdocs-material](https://squidfunk.github.io/mkdocs-material/) | `9.5.49` | Documentation |
106+
| [mkdocstrings[python]](https://mkdocstrings.github.io/) | `0.27.0` | MkDocs Plugin for Python AutoDoc |
107+
| [ruff](https://github.com/astral-sh/ruff) | `0.7.3` | Fast linter and formatter |
108+
| [uv](https://github.com/astral-sh/uv) | `0.5.1` | Python package management |
110109

111110
If Python is already installed in your machine, run the following commands to validate the versions:
112111

docs/examples/examples.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
# List of cmd2 examples
22

3-
{%
4-
include-markdown "../../examples/README.md"
5-
%}
3+
--8<-- "docs/../examples/README.md"

docs/index.md

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,46 +25,39 @@ app = App()
2525
app.cmdloop()
2626
```
2727

28-
<!-- Getting Started -->
28+
## Getting Started
2929

30-
{%
31-
include-markdown "./overview/index.md"
32-
%}
30+
See the [Getting Started](overview/index.md) section for info on how to get started building a
31+
`cmd2` application.
3332

34-
<!-- Migrating from cmd -->
33+
## Migrating from cmd2
3534

36-
{%
37-
include-markdown "./migrating/index.md"
38-
%}
35+
See the [Migrating from cmd2](migrating/index.md) section for info on how to migrate a `cmd`
36+
application to `cmd2`.
3937

4038
## Features
4139

42-
{%
43-
include-markdown "./features/index.md"
44-
start="<!--intro-start-->"
45-
end="<!--intro-end-->"
46-
%}
40+
See the [Features](features/index.md) section for a detailed guide to the features available within
41+
`cmd2`.
4742

4843
## Examples
4944

50-
{%
51-
include-markdown "./examples/index.md"
52-
start="<!--intro-start-->"
53-
end="<!--intro-end-->"
54-
%}
45+
See the [Examples](examples/index.md) section for various examples of using `cmd2`.
5546

5647
## Mixins
5748

58-
{%
59-
include-markdown "./mixins/index.md"
60-
start="<!--intro-start-->"
61-
end="<!--intro-end-->"
62-
%}
49+
See the [Mixins](mixins/index.md) section for info on how to extend `cmd2` using mixins.
6350

64-
## [Testing](testing.md)
51+
## Testing
6552

66-
## [API Reference](api/index.md)
53+
See the [Testing](testing.md) section for special considerations when writing unit or integration
54+
tests for a `cmd2` application.
55+
56+
## API Reference
57+
58+
See the [API Reference](api/index.md) for detailed information on the public API of `cmd2`.
6759

6860
## Meta
6961

70-
[Documentation Conventions](doc_conventions.md)
62+
See the [Documentation Conventions](doc_conventions.md) for info on conventions used in this
63+
documentation.

mkdocs.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ theme:
6060
plugins:
6161
- search
6262
- git-revision-date-localized
63-
- include-markdown:
64-
preserve_includer_indent: true
65-
dedent: true
66-
comments: false
6763
- macros:
6864
render_by_default: false
6965
on_error_fail: true
@@ -121,6 +117,9 @@ markdown_extensions:
121117
- pymdownx.inlinehilite
122118
- pymdownx.keys
123119
- pymdownx.smartsymbols
120+
- pymdownx.snippets:
121+
base_path: [".", "docs", "docs/overview"]
122+
check_paths: true
124123
- pymdownx.superfences:
125124
custom_fences:
126125
- name: mermaid
@@ -137,7 +136,7 @@ validation:
137136
absolute_links: info
138137
links:
139138
not_found: warn
140-
absolute_links: info
139+
absolute_links: ignore
141140
unrecognized_links: info
142141

143142
not_in_nav: |

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ dev = [
4545
"invoke>=2.2.1",
4646
"ipython>=8.23",
4747
"mkdocs-git-revision-date-localized-plugin>=1.5",
48-
"mkdocs-include-markdown-plugin>=7",
4948
"mkdocs-macros-plugin>=1.2",
5049
"mkdocs-material>=9.7.1",
5150
"mkdocstrings[python]>=1",
@@ -60,7 +59,6 @@ dev = [
6059
docs = [
6160
"black>=25",
6261
"mkdocs-git-revision-date-localized-plugin>=1.5",
63-
"mkdocs-include-markdown-plugin>=7",
6462
"mkdocs-macros-plugin>=1.2",
6563
"mkdocs-material>=9.7.1",
6664
"mkdocstrings[python]>=1",

0 commit comments

Comments
 (0)