qanda 答案中的源代码块

source blocks within qanda answers

我想用 Asciidoctor 创建问答。

大部分答案都涉及命令行指令,我想要在 [source] 部分中使用。但是,[source] 块似乎标志着 [qanda] 块的结束。

[qanda]
How do you show all the changes introduced in branchA since its common ancestor commit with branchB?::
    Having branchA and branchB as valid pointers, run
[source,sh]
----
$ git log branchB..branchA
----
You probably mean branchA and branchB to be recently related.

How do you see the contents of a stash?::
    `git stash show -p "stash{0}"`

第二个问题显示为带标签列表的第一个元素。

有没有办法在 Asciidoctor 中表达它?

您应该在 [source,sh] 之前的行中添加一个“+”。完整的文件应该如下所示:

[qanda] 
How do you show all the changes introduced in branchA since its common ancestor commit with branchB?::
Having branchA and branchB as valid pointers, run
+
[source,sh]
----
$ git log branchB..branchA
----
You probably mean branchA and branchB to be recently related.

How do you see the contents of a stash?::
`git stash show -p "stash{0}"`