rmarkdown 中的增量嵌套列表

Incremental nested lists in rmarkdown

我一直在使用 RMarkdown 制作一些幻灯片集,并且发现了关于嵌套列表和列表类型混合的奇怪行为。以下简短演示仅适用于幻灯片 2。嵌套列表不再嵌套,混合增量有序列表和无序列表完全失败。我已经用几种不同的表示格式尝试过,实际上对于不同的输出类型它会以不同的方式失败,这令人惊讶。

想法?

---
title: "Attempt"
output: revealjs::revealjs_presentation
---

## Nested Incremental Lists

> * This
>   + kinda works (but is not nested)


##  Incremental Ordered Lists
> 1. This
> 2. works

## Broken - Nested mixed lists

> 1. This
>   + Does not work

当我给出 2 个标签时有效,所以:

1. This
<tab><tab>+ Should work

尝试插入四个前导空格。来自 documentation(强调我的):

The four-space rule

A list item may contain multiple paragraphs and other block-level content. However, subsequent paragraphs must be preceded by a blank line and indented four spaces or a tab. The list will look better if the first paragraph is aligned with the rest:

制表符数量不一致可能是因为Rstudio默认插入了多少空格。

正如@Alex 提到的,您必须给它 4 个空格。如果您以后不想再担心这个,您可以将制表符预设为 4 个空格。解决方案将是

*something <space><space><space><space>+ Other thing

我遇到了同样的问题并找到了有效的解决方案。在没有增量显示的情况下制作嵌套列表时,您需要为子项目符号添加四个 space。制作增量展示列表时,需要在>后加一个space。因此,在使用增量显示制作子项目符号时,在 >- 之间需要五个 space(一个用于增量语法,四个用于嵌套列表语法)。

因此,具有增量显示的常规列表如下所示:

><space>- Point 1
><space>- Point 2

如果您想添加子项目符号,这将无效

><space>- Point 1
><space><space><space><space>- Sub-bullet
><space>- Point 2

但这起作用:

><space>- Point 1
><space><space><space><space><space>- Sub-bullet
><space>- Point 2

希望这是 helpful/readable!