How to nest code block under a list item in BitBucket mark down?

烂漫一生 提交于 2020-01-02 04:25:08

问题


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.

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?

And, here is the actual 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();
        }

```

回答1:


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


来源:https://stackoverflow.com/questions/40707725/how-to-nest-code-block-under-a-list-item-in-bitbucket-mark-down

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!