如何在 BitBucket mark down 中的列表项下嵌套代码块?
How to nest code block under a list item in BitBucket mark down?
虽然有几个 questions/answers 来自这个问题的关键字组合,但我没有看到直接提出或回答相同问题的人。
我想在列表项下嵌套一个代码块。当我按照 answer 进行操作时,我并没有完全得到我想要的效果。在下图中,我不希望代码块中有前导空格,我希望框本身在列表项下缩进。我该如何实现?
而且,这是实际的 MD:
** Help Page **
* This is a list item that has a code block going with it
```
#!c#
try
{
DoSomething(passThis, andThis);
}
catch (Exception ex)
{
ex.Log();
}
```
不要使用围栏代码块 (```
),而是使用缩进代码块。缩进四个空格以嵌套在列表项内,再缩进四个以表示代码块:
**Help Page**
* This is a list item that has a code block going with it
#!c
try
{
DoSomething(passThis, andThis);
}
catch (Exception ex)
{
ex.Log();
}
注意这里的语言标签应该是#!c
,而不是你问题中的#!c#
。
或者,您可以使用围栏代码块,但它仍必须缩进四个空格,以便包含在列表项中:
**Help Page**
* This is a list item that has a code block going with it
```c
try
{
DoSomething(passThis, andThis);
}
catch (Exception ex)
{
ex.Log();
}
```
虽然有几个 questions/answers 来自这个问题的关键字组合,但我没有看到直接提出或回答相同问题的人。
我想在列表项下嵌套一个代码块。当我按照 answer 进行操作时,我并没有完全得到我想要的效果。在下图中,我不希望代码块中有前导空格,我希望框本身在列表项下缩进。我该如何实现?
而且,这是实际的 MD:
** Help Page **
* This is a list item that has a code block going with it
```
#!c#
try
{
DoSomething(passThis, andThis);
}
catch (Exception ex)
{
ex.Log();
}
```
不要使用围栏代码块 (```
),而是使用缩进代码块。缩进四个空格以嵌套在列表项内,再缩进四个以表示代码块:
**Help Page**
* This is a list item that has a code block going with it
#!c
try
{
DoSomething(passThis, andThis);
}
catch (Exception ex)
{
ex.Log();
}
注意这里的语言标签应该是#!c
,而不是你问题中的#!c#
。
或者,您可以使用围栏代码块,但它仍必须缩进四个空格,以便包含在列表项中:
**Help Page**
* This is a list item that has a code block going with it
```c
try
{
DoSomething(passThis, andThis);
}
catch (Exception ex)
{
ex.Log();
}
```