How to Create a Distill Article

A collection of examples and best practices for creating interactive explanatory articles using the Distill web framework

Distill ships with a CSS framework and a collection of custom web components that make building interactive academic articles easier than raw HTML, CSS and JavaScript. This reference article details several examples and best practices for how to use both frameworks. Both are also available on Github with a permissive license, so feel free to use them independent of http://distill.pub as well.


Layouts

The main text column is referred to as the body. It is the assumed layout of any direct descendents of the dt-article element.

.l-body

.l-middle

.l-page

Occasionally you’ll want to use the full browser width. For this, use screen. You can also inset the element a little from the edge of the browser by appending, you guessed it, inset.

.l-screen

.l-screen-inset

Often you want to position smaller images so as not to completely interrupt the flow of your text. Or perhaps you want to put some text in the margin as an aside or to signal that it’s optional content. For these cases we’ll use the float-based .side layouts.

.l-body.side

.l-page.side

They are all floated to the right and anchored to the right-hand edge of the position you specify. By default, each will take up approximately half of the width of the standard layout position, but you can override the width with a more specific selector.

.l-gutter

The final layout is for marginalia, asides, and footnotes. It does not interrupt the normal flow of .l-body sized text except on mobile screen sizes.


Markdown

Any element with a `dt-markdown` attribute will be rendered with its contents replaced with a markdown processed version. We use [marked](https://github.com/chjj/marked), with [github flavored markdown](https://help.github.com/articles/basic-writing-and-formatting-syntax/) and [smartypants](https://daringfireball.net/projects/smartypants/).

  <div dt-markdown>
  ###This markdown will be rendered as HTML

  For more about markdown, read this [tutorial](https://help.github.com/articles/basic-writing-and-formatting-syntax/).
  </div>

  

Code Blocks

Syntax highlighting is provided within <code> tags. Just wrap the source with this: <code class="language-html">let x = 10;</code>. For larger blocks of code, add a <pre> tag:


    <pre><code class="language-javascript">
      var x = 25;
      function(x){
        return x * x;
      }
    </code></pre>
  

You can also use code blocks within markdown blocks. For instance:


    <div dt-markdown>
    ```javascript
    let x = 25;
    ```
    </div>
  

Citation

Take a look at this paper gregor2015draw which is about X.

Why do we reason mercier2011humans


Math


Footnotes

This is a

Contributions

List of who did what