Kitchen Sink
This page serves as a reference to the features supported by the MyST + Sphinx + Read The Docs stack that is used to create this wiki page. This page is probably best viewed in source which you can find with the “Edit on GitHub” link in the top right. If you are using Visual Studio Code, the MyST-Markdown plugin is recommended as it provides code snippets for the different directives that MyST adds to regular Markdown. In general, a block is surrounded by :::
followed by the name of the directive inside { }
. Directives can have arguments, which are surrounded by : :
.
For example of this:
:::{directive} Parameter
:argument:
:second-argument: Foobar
:::
Markup
Standard Github-flavored Markdown is available as a basis. You can find more information about it here. For completeness, here is a quick reference list:
Element |
Markdown Syntax |
Description |
---|---|---|
Header 1 |
|
Largest header, equivalent to |
Header 2 |
|
Second largest header |
Header 3 |
|
Third largest header |
Header 4 |
|
Fourth largest header |
Header 5 |
|
Fifth largest header |
Bold Text |
|
Makes text bold |
Italic Text |
|
Makes text italic |
Link |
|
Creates a hyperlink with the provided text |
Image |
|
Embeds an image |
Unordered List |
|
Creates a bulleted list |
Ordered List |
|
Creates a numbered list |
Blockquote |
|
Creates a blockquote |
Code (Inline) |
|
Displays inline code |
Code (Block) |
|
Displays a block of code |
Table |
See source |
Creates a table |
Heading without TOC entry
A heading that will not show up in the table of contents
Subscript/Superscript
We can also write text in subscript, or superscript or other hings
Abbreviations
Defining abbreviations, which have an explanation that is visible via hovering over the text: LIFO
Commands
Displaying a program that is available on the computer: rm
Keystrokes
Showing a combination of keystrokes that should be pressed by a person to achieve something: C-x C-f
Inline comments
Icons embedding
We can also provide images directly into the text: . The list of all icons can be found here.
Tables
Markdown-style
foo |
bar |
---|---|
baz |
bim |
MyST style
foo |
bar |
---|---|
baz |
bim |
Multi-column table
|
|
Links
A link that doesn’t have the URL locally, but hidden away in the bottom of the file. The link here would be the same as this link. We can also add footnotes, either as a manually-numbered reference[3], or an automatically-numbered reference[1]. Footnotes can also be a lot longer, too[2]. The actual content behind the footnote can be placed anywhere in the source file, but will always be rendered at the bottom of the page.
Footnotes
This is not part of the footnote.
Images
Markdown
The normal Markdown way:
Centering images
But MyST also added a second method that has way more options. See their documentation for more information.
Dark and Light theme
We can use different images for light and dark themes
Videos
Embedding videos does not work natively in Markdown and we need to fall back to raw HTML instead:
Callouts
MyST adds a bunch of different admonition styles, which are demonstrated here.
Attention
Attention
Caution
Caution
Danger
Danger
Error
Error
Hint
Hint
Important
Important
Note
Note
See also
Some other information that would be good to checkout
Tip
tip
Warning
warning
Look ma! A custom title.
It looks different though.
Another Custom Title
Maaa! I made it look the same by setting the class.
Markups
New in version 2.5: If something is only available in a specific version
Changed in version 3.1: Something has changed in this version
Deprecated since version 4.5: Something has been deprecated but not removed
Code Highlighting
Default language
-- There is no default language for code blocks
local abc = function()
return [[
a
]]
end
-- This is also true for standard Markdown code highlighting
function(abc)
return abc + abc
end
Different language
-- But we can manually specify which language it is
local abc = function()
return [[
a
]]
end
-- Also for blocks
function(abc)
return abc + abc
end
// It's possible to change the language for the syntax highlighting as well
std::vector<std::optional> foo() {
return std::nullopt;
}
// Same for the standard Markdown, which is nicer for Visual Studio Code syntax highlighting
std::string_view bar() { return "abc"; }
Highlight lines
1// Highlighting some lines
2int bar() {
3 constexpr int One = 1;
4 constexpr int Two = 2;
5 constexpr int Three = 3;
6
7 return One + Two + Three;
8}
Function defintions
It is also possible to define functions in place:
- send_message(sender, priority)
Send a message to a recipient
- Parameters:
sender (str) – The person sending the message
priority (int) – The priority of the message, can be a number 1-5
- Returns:
the message id
- Return type:
int
- Raises:
ValueError – if the message_body exceeds 160 characters
Math
There are different ways of highlighting mathematical equations, all of which use LaTeX-based syntax. Equations can be provided inline, for example like this: \(a^2 + b^2 = c^2\). Alternatively, it is also possible to provide formulas in a block environment. Option 1 as a directive:
and option 2 using the $$ markers:
$$ \sum_{i=0}^\infty i^2 $$
Cards
Some header information
Some text that is displayed in a nice card
More fullyfledged example from the MyST documentation:
MyST extends the CommonMark syntax specification, to support technical authoring features such as tables and footnotes.
Use the MyST role and directive syntax to harness the full capability of Sphinx, such as admonitions and figures, and all existing Sphinx extensions.
MyST-parser can be configured at both the global and individual document level, to modify parsing behaviour and access extended syntax features.
Carousels
Dropdown
No Title
Dropdown content
With title
Dropdown title
Dropdown content
Standard open
Open dropdown
Dropdown content
Tabs
Tabs can be useful if there are multiple ways of doing something, for example if we want to highlight examples in multiple programming languages.
Content 1
Content 2
local openspace = ...
openspace.globebrowsing.goToGeo(123.0, -40.0)
let openspace = ...;
openspace.globebrowsing.goToGeo(123.0, -40.0)
openspace = ...
openspace.globebrowsing.goToGeo(123.0, -40.0)
Diagram
See MermaidJS documentation for more information about the available diagram types
Glossary
Defining glossary terms that can be used across the entire documentation page. Regardless where the glossary terms are defined, they will be usable on any page.
- Some Term
The description what the term means.
- Another Term
And another description.
- Yet Another Term
And yet another description.
To use it in the text use it like this Sphinx
Section Labels
Some way to specify targets for referencing back to it:
Text text text
Now we can refer back to the previous section reference by inserting it in the text.
Include files
Verbatim include
Include the .gitignore
file:
pycache .venv build generated
Include file with syntax highlighting
Raw include
{
"aaa": {
"def": 1,
"ghi": "abc"
},
"bbb": [
1, 2, 3, 4
],
"ccc": false
}
Emphasize lines
{
"aaa": {
"def": 1,
"ghi": "abc"
},
"bbb": [
1, 2, 3, 4
],
"ccc": false
}
Selected lines
Only show selected lines
{
"def": 1,
1, 2, 3, 4
],
"ccc": false
}