如何将代码块嵌套在BitBucket中的列表项下? [英] How to nest code block under a list item in BitBucket mark down?

查看:95
本文介绍了如何将代码块嵌套在BitBucket中的列表项下?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然有多个问题/答案,以及来自该问题的关键字组合,但我看不到直接问相同问题或回答该问题的答案.

While there are several questions/answers with combination of keywords from this question, I don't see one that directly asks the same question or answers it.

我想在列表项下嵌套一个代码块.当我遵循此 answer 时,我并没有获得想要的效果.在下图中,我不希望代码块中的前导空格,并且我希望框本身在列表项下缩进.我该如何实现?

I want to nest a code block under a list item. When I follow this answer, I don't quite get the effect I'm looking for. In below image, I wouldn't want the leading spaces in the code block and I would like the box itself to be indented under the list item. How do I achieve this?

这是实际的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();
        }

```

推荐答案

使用缩进的代码块代替受防护的代码块(```).缩进四个空格以嵌套在列表项中,另外四个空格代表一个代码块:

Instead of a fenced code block (```), use an indented code block. Indent with four spaces to nest inside the list item, and four more to represent a code block:

**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();
        }

这篇关于如何将代码块嵌套在BitBucket中的列表项下?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆