格式以在Markdown列表中添加标准代码块 [英] Format to add standard code blocks within Markdown lists

查看:1112
本文介绍了格式以在Markdown列表中添加标准代码块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现我无法在编号列表中找到代码块.

I've found that I can't get code blocks within numbered lists.

例如,当我通过缩进四个空格来添加代码块时,通常如下所示:

For example, when I add a code block by indenting by four spaces normally like below:

1. Do the first thing

    $ git stuff
    $ git other stuff 

2. second thing:

    $ git more stuff

它是这样显示的,其中$ git行是普通文本,并且未设置为代码格式:

it comes out like this, where the $ git lines are normal text and are not formatted as code:

  1. 做第一件事

  1. Do the first thing

$ git的东西 $ git其他东西

$ git stuff $ git other stuff

第二件事:

还有$ git个东西

我可以使用反引号来实现,即

I can use the backticks to do it, i.e.

1. Do the first things

    `$ git stuff`  
    `$ git other stuff` 

2. second thing:

    `$ git more stuff`

但是如果可以的话,我想做正常"的块(缩进4个空格).

but I would like to do the blocks 'normally' (4 space indent) if I can.

推荐答案

文档需要做额外的缩进; +4空格或+1制表符(第0列分别为8/2).

Per the documentation you need to do extra indentation; +4 spaces or +1 tab (8/2, respectively, from column 0).

1. Item 1

        $git stuff
        $git other stuff

2. Item 2

        $git more stuff

这些换行符是必需的.

这篇关于格式以在Markdown列表中添加标准代码块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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