7.4 Bullet list

Third level lists need an extra tab. ↩︎

Q: I think you need four spaces (or a true tab instead of two spaces) to indicate a new level. The syntax of remark.js’s Markdown is different with Pandoc’s Markdown. This works fine:

# Hello World

- Here are some bullet points using markdown syntax
    - Here's the next level
        - And this should be a lower level, but it isn't
            - Whereas this is:

- To summarise:
    - To get third level bullets:
        - You have to use an extra tab on the third level.

1. No tabs
    1. One tab
        1. Two tabs
            1. Three tabs

7.4.1 Ordered list with letters

Issue: xaringan does not recognize letters as list markers for ordered lists by default.

Explain: xaringan uses remark.js to render slides, which uses its own markdown parser that does not support letters as list markers for ordered lists. You cannot “load” fancy_lists directly in xaringan even if you add pandoc_args: ["-f", "markdown+fancy_lists"] to your YAML. It won’t have an effect — because xaringan::moon_reader doesn’t use Pandoc’s list rendering and therefore will ignore the args. The Markdown is passed to remark.js, which uses its own internal syntax rules.

Fix: Use CSS to customize the list style or use html tags directly.

  1. Define a custom class in CSS, e.g., in custom.css:

    /* Lettered lists */
    .remark-slide-content .alpha-list ol {
        list-style-type: lower-alpha; /* or upper-alpha for uppercase letters */
    }

    Then you can apply this class to a list:

    .alpha-list[
    1. First item
    2. Second item
       1. Subitem
       2. Subitem
    3. Third item
    ]

    will be rendered as:

    a. First item
    b. Second item
       i. Subitem
       ii. Subitem
    c. Third item
  2. Use html tags directly:

    <ol type="a">
      <li>First item</li>
      <li>Second item
        <ol type="i">
          <li>Subitem</li>
          <li>Subitem</li>
        </ol>
      </li>
      <li>Third item</li>
    </ol>

    will generate the same output as above.