---
title: Qmd Documents
description: Introduction to qmd -- markdown on steroids
order: 3
execute:
  echo: false
  output: asis
---
*Qmd documents* are Markdown documents with executable `{python}` code blocks and rich layout directives rendered by `fastship` (via `mdhtml` and `execnb.minipy`, with no Quarto or Pandoc installation required). Every markdown cell in a `fastship` notebook supports the same Markdown extensions, and `fastship` also builds plain `.md` files, `.qmd` files, and [RenderScripts](renderscript.md).

Just like with RenderScripts, you can use hot/live reloading with plain qmd text files -- so as soon as you save the file, you'll see the new output in your web browser (assuming you've got `ship-preview` running).

## Computations

You can generate data-driven documents using qmd files. For instance, consider this table (also shown in the RenderScript tutorial for comparison), containing a list of the people with testimonials on fastship's home page:

|  | Name | Position |
|--- |--- |--- |
| <img src="../images/chris-lattner.png" alt="" width="60%" /> | Chris Lattner | Inventor of Swift and LLVM |
| <img src="../images/fernando-p%C3%A9rez.jpeg" alt="" width="60%" /> | Fernando Pérez | Creator of Jupyter |
| <img src="../images/david-berg.jpeg" alt="" width="60%" /> | David Berg | Software Engineer, Netflix |
| <img src="../images/erik-gaasedelen.jpeg" alt="" width="60%" /> | Erik Gaasedelen | Software Engineer, Lyft |
| <img src="../images/roxanna-pourzand.jpeg" alt="" width="60%" /> | Roxanna Pourzand | Product Manager, Transform |
| <img src="../images/hugo-bowne-anderson.jpeg" alt="" width="60%" /> | Hugo Bowne-Anderson | Head of Developer Relations, Outerbounds |

The table above is generated using an embedded `{python}` computation block from the following Python list:

```python
testimonials = [
    ('chris-lattner.png', 'Chris Lattner', 'Inventor of Swift and LLVM'),
    ('fernando-pérez.jpeg', 'Fernando Pérez', 'Creator of Jupyter'),
    ('david-berg.jpeg', 'David Berg', 'Software Engineer, Netflix'),
    ('erik-gaasedelen.jpeg', 'Erik Gaasedelen', 'Software Engineer, Lyft'),
    ('roxanna-pourzand.jpeg', 'Roxanna Pourzand', 'Product Manager, Transform'),
    ('hugo-bowne-anderson.jpeg', 'Hugo Bowne-Anderson', 'Head of Developer Relations, Outerbounds')
]
```

Just like in the RenderScript example, to produce the table from this python list, the following four lines of code are used:

```python
print(row(['', 'Name', 'Position']))
print(row(['---', '---', '---']))
for fname, name, position in testimonials:
    print(row([im(fname, 60), name, position]))
```

For data-driven documents such as this one, we add the following to the YAML frontmatter, which hides the code used to produce outputs, and also does not add any extra formatting to outputs:

```
---
execute:
  echo: false
  output: asis
---
```

Compare the source code of the RenderScript example and of the current page to see how computations are used in RenderScripts compared to plain qmd text files. We find that we like to use Notebooks for most pages we build, since they've got so much helpful functionality (such as pasting images directly into cells). We use RenderScripts for complex web pages like the fastship home page, and qmd files for pages that are mainly markdown and don't need any notebook functionality.

## Formatting

In addition to standard GitHub-flavored Markdown, `fastship` (`mdhtml`) supports fenced divs, callouts, tabsets, wide column classes, and figure layouts. Here are a few highlights:

### Divs and classes

You can create HTML divs by surrounding lines with `:::`. Divs can include classes by placing `{.classname}` after the opening `:::`. Here is an example:

```markdown
::: {.border}
This content can be styled with a border
:::
```

This is how that's rendered:

This content can be styled with a border

Add custom styling for any class in your site CSS file. Every notebook markdown cell supports the same fenced divs and classes.

### Callouts

A special kind of block you can use is a callout block. Here is an example:

```markdown
:::{.callout-note}
Note that there are five types of callouts, including:
`note`, `warning`, `important`, `tip`, and `caution`.
:::
```

...and here's how it's rendered:

> [!NOTE]
> Note that there are five types of callouts, including: `note`, `warning`, `important`, `tip`, and `caution`.

### Images

You can add images with captions and arrange them into multi-column layouts. Here is an example:

```markdown
::: {layout-ncol=3}
![Jupyter](/images/jupyter.svg)

![Vscode](/images/vscode.svg)

![Git](/images/git.svg)
:::
```

<img src="../images/jupyter.svg" alt="Jupyter" width="100px" fig-align="left" />


Figure 1: Jupyter

<img src="../images/vscode.svg" alt="Vscode" width="100px" fig-align="left" />


Figure 2: Vscode

<img src="../images/git.svg" alt="Git" width="100px" fig-align="left" />


Figure 3: Git
