Skip to content

Commit 400a9a0

Browse files
Example of how to integrate markdown with rst
1 parent 3c0429e commit 400a9a0

File tree

5 files changed

+122
-3
lines changed

5 files changed

+122
-3
lines changed

conf.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,17 @@
3131
extensions = [
3232
'sphinx.ext.todo',
3333
'sphinx.ext.mathjax',
34-
'sphinxcontrib.mermaid'
34+
'sphinxcontrib.mermaid',
35+
'myst_parser'
3536
]
3637

3738
# Add any paths that contain templates here, relative to this directory.
3839
templates_path = ['_templates']
3940

4041
# The suffix(es) of source filenames.
4142
# You can specify multiple suffix as a list of string:
42-
# source_suffix = ['.rst', '.md']
43-
source_suffix = '.rst'
43+
source_suffix = ['.rst', '.md']
44+
#source_suffix = ['.rst']
4445

4546
# The encoding of source files.
4647
#source_encoding = 'utf-8-sig'

index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Contents
5151
cpt-containers
5252
part-advanced
5353
part-appendix
54+
part-md
5455

5556

5657
Contact and Authors

md_test1.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
(md_test_label1)=
2+
# Markdown Test
3+
4+
- This [here](https://docs.readthedocs.io/en/stable/guides/migrate-rest-myst.html) is a documentation how to migrate from rst to md
5+
6+
- Most important functionality needed here is listed below
7+
8+
(md_test_label2)=
9+
## Codesections
10+
Inline codesection `my code is here` written by using `` around the text
11+
12+
### Codeblocks
13+
14+
Using ``` or ~~~ following the optional code block type (c++, vim, py,...) and a new line.
15+
16+
~~~
17+
```vim
18+
sudo cvmfs_config setup
19+
20+
cvmfs_config chksetup
21+
--> OK
22+
```
23+
~~~
24+
25+
creates
26+
27+
```vim
28+
sudo cvmfs_config setup
29+
30+
cvmfs_config chksetup
31+
--> OK
32+
```
33+
34+
35+
(md_test_label3)=
36+
## Tables
37+
```
38+
|Option|Function|
39+
|---|---|
40+
|CVMFS_HTTP_PROXY|Proxy setting for repos|
41+
|CVMFS_QUOTA_LIMIT|Quota in MB of local cvmfs cache|
42+
```
43+
44+
creates
45+
46+
|Option|Function|
47+
|---|---|
48+
|CVMFS_HTTP_PROXY|Proxy setting for repos|
49+
|CVMFS_QUOTA_LIMIT|Quota in MB of local cvmfs cache|
50+
51+
## Labels
52+
53+
### Reference to a file
54+
55+
`[test](cpt-xcache.rst)` creates [test](cpt-xcache.rst)
56+
57+
### Create custom label
58+
In markdown
59+
```
60+
(md_test_label3)=
61+
## Tables
62+
and the normal text follows
63+
this label style is not a markdown style specific to sphinx
64+
```
65+
66+
In rst
67+
```
68+
.. _apxsct_serverparameters:
69+
```
70+
71+
### Referencing a custom label
72+
- Does not dependent if it is in local file or some other part of the documentation
73+
- Labels must be unique accross all files
74+
75+
In markdown
76+
```
77+
{ref}`Use label from this md file<md_test_label3>`.
78+
{ref}`md_test2_label`.
79+
{ref}`If using text-based labels you need to provide test <md_test2_label2>`.
80+
{ref}`Use label from rst part of docs without underscore _ <apxsct_serverparameters>`.
81+
82+
```
83+
84+
{ref}`Use label from this md file<md_test_label3>`.
85+
86+
{ref}`md_test2_label`.
87+
88+
{ref}`If using text-based labels you need to provide test <md_test2_label2>`.
89+
90+
{ref}`Use label from rst part of docs without underscore _ <apxsct_serverparameters>`.
91+
92+
93+
## Other Markdown Stuff
94+
- `<u>something</u>` underline <u>something</u>
95+
- To comment stuff out within the md file use html comment `< !-- remove the space before the ! for comment section -->`
96+
97+

md_test2.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(cvmfs_test_title)=
2+
# Another MD Testfile
3+
4+
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
5+
6+
(md_test2_label)=
7+
## Label In Other Markdown File
8+
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
9+
10+
(md_test2_label2)=
11+
My text-only label

part-md.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
********************
2+
Markdown Integration
3+
********************
4+
5+
.. toctree::
6+
:maxdepth: 2
7+
8+
md_test1
9+
md_test2

0 commit comments

Comments
 (0)