Rincewind
Rincewind

Reputation: 131

R Markdown: Empty line between list items

I've encountered something in R Markdown, that is somewhat puzzling to me. When using ordered lists, I sometimes run into a case where no empty line is added between the list item. That happens after the second level of a list and going back to a first-level item. If the example below is "knitted" in Markdown, no empty line is added between the last subpoint of 2. and the 3. point.

1. This is a thing

2. This is another thing
    + This is some subpoint thing
    + This, too, is something

3. This thing should have an empty line above it. It does, when compiled as pdf, it doesn't in html.

I tried two spaces, \newline in various locations, but nothing worked correctly. I'm sure it's something easy that I just missed...

Thanks y'all!

Upvotes: 2

Views: 2459

Answers (2)

Eliot Dixon
Eliot Dixon

Reputation: 170

Here's another way to accomplish this if you'd like this to be applied to all unordered sub-lists. The > symbol specifies that this style should be applied to ul elements which are direct children of li elements.

```{css, echo=FALSE}
li > ul {
margin-bottom: 10px;
}
```

Upvotes: 0

Marius
Marius

Reputation: 60230

This seems to be a result of the CSS used in the default html output, where margin-bottom is set to 0 for sublists. You can override this using CSS e.g.:

<style>
ol ul {
    margin-bottom: 10px;
}
</style>

1. This is a thing

2. This is another thing
    + This is some subpoint thing
    + This, too, is something

3. This thing should have an empty line above it. It does, when compiled as pdf, it doesn't in html

Upvotes: 2

Related Questions