Skip to content

Commit 959feab

Browse files
Build docs with myst instead of rst (#5)
* Build docs with myst instead of rst * Add markdown support to the extension * Fix file extension check * Update docs to advertise md support
1 parent 78e914b commit 959feab

File tree

9 files changed

+456
-255
lines changed

9 files changed

+456
-255
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Features:
88

99
- Render documentation from your `Chart.yaml` and `values.yaml` files.
1010
- Sphinx extension for including in Python documentation.
11+
- Works with `rst` and `md` documentation source files.
1112

1213
## Installation
1314

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# Add any Sphinx extension module names here, as strings. They can be
2727
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
2828
# ones.
29-
extensions = ["sphinx_helm.ext", "sphinx_click.ext"]
29+
extensions = ["sphinx_helm.ext", "sphinx_click.ext", "myst_parser"]
3030

3131
# Add any paths that contain templates here, relative to this directory.
3232
templates_path = ["_templates"]

docs/customizing.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Customizing your docs
2+
3+
TODO

docs/customizing.rst

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/index.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Sphinx-helm
2+
3+
```{toctree}
4+
:maxdepth: 2
5+
:hidden: true
6+
customizing
7+
```
8+
9+
`sphinx-helm` is a [Sphinx](https://www.sphinx-doc.org/) plugin for automatically generating documentation for your [Helm charts](https://helm.sh/).
10+
11+
It will use the chart's `Chart.yaml` and `values.yaml` files in order to
12+
generate the content in a markup language of your choice.
13+
14+
## Features
15+
16+
- Render documentation from your `Chart.yaml` and `values.yaml` files.
17+
- Sphinx extension for including in Python documentation.
18+
- Works with `rst` and `md` documentation source files.
19+
20+
## Installation
21+
22+
```console
23+
$ pip install sphinx-helm
24+
```
25+
26+
## Example
27+
28+
Create an example `hello-world` Helm chart with `helm create`.
29+
30+
```console
31+
$ helm create hello-world
32+
Creating hello-world
33+
```
34+
35+
- Enable the plugin in your Sphinx ``conf.py`` file:
36+
37+
```python
38+
extensions = ['sphinx-helm.ext']
39+
```
40+
41+
- Now you can use the `helm` directive wherever you wish in your documentation.
42+
43+
```rst
44+
.. helm:: path/to/hello-world
45+
```
46+
47+
```{note}
48+
sphinx-helm paths are relative to the root of your documentation.
49+
```
50+
51+
## Example
52+
53+
*The following was autogenerated from the simple nginx example chart in sphinx-helm's test suite.*
54+
55+
56+
```{helm} ../sphinx_helm/tests/mockcharts/simple
57+
58+
```

docs/index.rst

Lines changed: 0 additions & 65 deletions
This file was deleted.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ test = [
1919
docs = [
2020
"sphinx",
2121
"sphinx-click",
22+
"myst-parser>=3.0.1",
2223
]
2324

2425
[build-system]

sphinx_helm/ext.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ def run(self):
2222
self.arguments[0],
2323
)
2424
if self.options.get('output_format') is None:
25-
self.options.update({'output_format': 'rst'})
25+
# if page is being built with myst use markdown
26+
if self.state.document.current_source.endswith('.md'):
27+
self.options.update({'output_format': 'markdown'})
28+
else:
29+
self.options.update({'output_format': 'rst'})
2630
output = ViewList(gen(chart_path, output_format=self.options.get('output_format')).split("\n"))
2731

2832
node = nodes.section()

uv.lock

Lines changed: 387 additions & 184 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)