在 Asciidoctor 中嵌套项目符号列表和段落
Nesting bullet lists and paragraphs in Asciidoctor
我应该如何编写 Asciidoc(tor) 以获得以下输出:
* item 1
* item a
paragraph 1 inside item a
* item a.1 inside paragraph 1 inside item a
paragraph a.1 inside item a.1
* item a.2 inside paragraph 1 inside item a
paragraph a.2 inside item a.1
paragraph 2 inside item a
* item b
paragraph 1 inside item b
* item 2
更新:@TigerTV.ru 提出了一个很好的技巧,但它需要能够隐藏项目符号列表中的项目符号。如何做到这一点?
谢谢
您可以使用几个星号表示级别:
* item 1
** item a
*** paragraph 1 inside item a
**** item a.1 inside paragraph 1 inside item a
**** item a.2 inside paragraph 1 inside item a
*** paragraph 2 inside item a
** item b
*** paragraph 1 inside item b
* item 2
https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#lists
认为这可行:
* item 1
** item a +
paragraph 1 inside item a
+
--
*** item a.1 inside paragraph 1 inside item a +
paragraph a.1 inside item a.1
*** item a.2 inside paragraph 1 inside item a +
paragraph a.2 inside item a.1
--
+
paragraph 2 inside item a
** item b +
paragraph 1 inside item b
* item 2
使用 Asciidoctor 测试 1.5.6.1
。
https://asciidoctor.org/docs/user-manual/#attaching-to-an-ancestor-list:
You may find that you need to attach block content to a parent list item instead of the current one. In other words, you want to attach the block content to the parent list item so it becomes a sibling of the child list. To do this, you add a blank line before the list continuation.
* parent list item
** child list item
+
paragraph attached to parent list item
更复杂的示例:
* Foo
** Aaa
** Bbb
+
Continuation of Foo
* Bar
+
Continuation of Bar
* Baz
+
Continuation of Baz
** Ccc
** Ddd
* Xyz
备注:
Bbb 后需要空行。这是设计使然:
The blank line signals to the list continuation to move out of the current list so it attaches the block to the last item of the parent list.
您还需要在抄送前留空行。目前这是一个未解决的问题 #2509。
A block attached to the grandparent list item:
* grandparent list item
** parent list item
*** child list item
+
paragraph attached to grandparent list item
Using blank lines to back out of the nesting may feel fragile. A more robust way to accomplish the same thing is to enclose the nested lists in an open block. That way, it’s clear where the nested list ends and the enclosing list continues:
* grandparent list item
+
--
** parent list item
*** child list item
--
+
paragraph attached to grandparent list item
我应该如何编写 Asciidoc(tor) 以获得以下输出:
* item 1
* item a
paragraph 1 inside item a
* item a.1 inside paragraph 1 inside item a
paragraph a.1 inside item a.1
* item a.2 inside paragraph 1 inside item a
paragraph a.2 inside item a.1
paragraph 2 inside item a
* item b
paragraph 1 inside item b
* item 2
更新:@TigerTV.ru 提出了一个很好的技巧,但它需要能够隐藏项目符号列表中的项目符号。如何做到这一点?
谢谢
您可以使用几个星号表示级别:
* item 1
** item a
*** paragraph 1 inside item a
**** item a.1 inside paragraph 1 inside item a
**** item a.2 inside paragraph 1 inside item a
*** paragraph 2 inside item a
** item b
*** paragraph 1 inside item b
* item 2
https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#lists
认为这可行:
* item 1
** item a +
paragraph 1 inside item a
+
--
*** item a.1 inside paragraph 1 inside item a +
paragraph a.1 inside item a.1
*** item a.2 inside paragraph 1 inside item a +
paragraph a.2 inside item a.1
--
+
paragraph 2 inside item a
** item b +
paragraph 1 inside item b
* item 2
使用 Asciidoctor 测试 1.5.6.1
。
https://asciidoctor.org/docs/user-manual/#attaching-to-an-ancestor-list:
You may find that you need to attach block content to a parent list item instead of the current one. In other words, you want to attach the block content to the parent list item so it becomes a sibling of the child list. To do this, you add a blank line before the list continuation.
* parent list item ** child list item + paragraph attached to parent list item
更复杂的示例:
* Foo
** Aaa
** Bbb
+
Continuation of Foo
* Bar
+
Continuation of Bar
* Baz
+
Continuation of Baz
** Ccc
** Ddd
* Xyz
备注:
Bbb 后需要空行。这是设计使然:
The blank line signals to the list continuation to move out of the current list so it attaches the block to the last item of the parent list.
您还需要在抄送前留空行。目前这是一个未解决的问题 #2509。
A block attached to the grandparent list item:
* grandparent list item ** parent list item *** child list item + paragraph attached to grandparent list item
Using blank lines to back out of the nesting may feel fragile. A more robust way to accomplish the same thing is to enclose the nested lists in an open block. That way, it’s clear where the nested list ends and the enclosing list continues:
* grandparent list item + -- ** parent list item *** child list item -- + paragraph attached to grandparent list item