Markdown Support
Runbooks renders GitHub-flavored Markdown (GFM).
Supported elements
Section titled “Supported elements”Headers
Section titled “Headers”# Header 1## Header 2### Header 3#### Header 4##### Header 5###### Header 6Text formatting
Section titled “Text formatting”**Bold text***Italic text****Bold and italic***~~Strikethrough~~`Inline code`Unordered lists:
- Item 1- Item 2 - Nested item - Another nested item- Item 3Ordered lists:
1. First item2. Second item3. Third item 1. Nested numbered itemTask lists:
- [x] Completed task- [ ] Incomplete task- [ ] Another task[Link text](https://example.com)[Link with title](https://example.com "Title text")Autolinks
Section titled “Autolinks”URLs and email addresses are automatically converted to clickable links:
Visit https://gruntwork.io for more info.Contact support@example.com for help.Images
Section titled “Images”Image paths must start with ./assets/. Runbooks loads them from the assets/ folder next to your runbook file. Any other relative path, such as images/diagram.png or assets/diagram.png without the leading ./, won’t load. To set an image’s size, use an <img> tag with the same kind of path, for example <img src="./assets/image.png" width="400" />. See Relative paths for video and audio.
Code blocks
Section titled “Code blocks”Inline code:
Use the `npm install` command to install dependencies.Code blocks with syntax highlighting:
```bashecho "Hello, world!"```
```pythondef hello(): print("Hello, world!")```
```javascriptconsole.log("Hello, world!");```Supported languages include bash, sh, shell, python, javascript, typescript, go, rust, java, terraform, hcl, yaml and json.
Blockquotes
Section titled “Blockquotes”> This is a blockquote.> It can span multiple lines.>> And have multiple paragraphs.Horizontal rules
Section titled “Horizontal rules”---***___Tables
Section titled “Tables”| Header 1 | Header 2 | Header 3 ||----------|----------|----------|| Cell 1 | Cell 2 | Cell 3 || Cell 4 | Cell 5 | Cell 6 |With alignment:
| Left-aligned | Center-aligned | Right-aligned ||:-------------|:--------------:|--------------:|| Left | Center | Right |Footnotes
Section titled “Footnotes”Here is a sentence with a footnote.[^1]
[^1]: This is the footnote content.Footnotes are collected and rendered at the bottom of the document.
MDX features
Section titled “MDX features”MDX adds a few things on top of markdown.
Mix markdown and JSX
Section titled “Mix markdown and JSX”# My Runbook
Regular markdown text here.
<Admonition type="info" title="Note" description="This is a React component!" />
More markdown text.Literal values in props
Section titled “Literal values in props”Use {...} to pass a prop value that isn’t a plain string, such as a number, a boolean, an array or an object:
<Command id="build" command="make build" timeoutMs={300000} />
<AwsAuth id="prod-auth" detectCredentials={[{ env: { prefix: 'PROD_' } }, 'env']} />Runbooks never runs JavaScript from your runbook.mdx. The value inside {...} must be a literal: a string, number, boolean or null, a template string without ${...} substitutions, or an array or object made only of those. You can also write {/* comments */}. import and export statements, JavaScript expressions such as {new Date().toLocaleDateString()}, and spread props such as {...props} are rejected with an error when the runbook opens. See the execution security model for why.
You can use HTML directly in markdown:
<div style={{ color: "red" }}>This text will be red.</div>MDX reads HTML as JSX, so it follows JSX’s rules rather than HTML’s:
- Close every element, including void elements such as
<br />,<hr />and<img ... />. A bare<br>fails with “Expected a closing tag”. - Give
stylean object, as above. A string such asstyle="color: red;"fails when the runbook renders. - Write comments as
{/* comment */}. An HTML comment,<!-- comment -->, fails to compile.
Because Runbooks never runs JavaScript from your runbook.mdx, elements and props that load scripts, embed other documents or inject raw HTML are rejected with an error. These include <script>, <iframe>, <object>, <embed>, custom elements such as <my-widget>, namespaced elements such as <svg:script>, dangerouslySetInnerHTML, srcDoc and javascript: URLs in props. See the execution security model for the full list.
Escaping special characters
Section titled “Escaping special characters”To display a markdown character literally, escape it with a backslash:
\* This won't be italic\# This won't be a header\`This won't be code\`In MDX, < before a letter starts a tag and { starts an expression, so escape those too, or put them in inline code:
Use the \<Inputs\> block to collect values.Write `{{ .inputs.ProjectName }}` in a block's props to use the value.Unescaped, Use the <Inputs> block fails with “Expected a closing tag for <Inputs>”, and {{ .inputs.ProjectName }} fails with “Could not parse expression with acorn”. Template expressions aren’t resolved in prose. To show a value the user entered, use a block that resolves it, such as an <Admonition> with inputsId.
Code blocks inside blocks
Section titled “Code blocks inside blocks”Blocks such as <Inputs> take a fenced code block as their content:
<Inputs id="my-form">```yamlvariables: - name: Example type: string```</Inputs>To show a fenced block inside another fenced block, as this page does, give the outer fence more backticks than the inner one. Do not escape the inner backticks.