【问题标题】:indent code correctly in Github list item in README.md在 README.md 的 Github 列表项中正确缩进代码
【发布时间】:2021-08-17 13:22:19
【问题描述】:

我正在 github 中为我的 Repo 创建 README.md 文件,但我无法缩进 代码块,因为我的 list items 从左侧缩进,我正在尝试 bottom,我希望这段代码以 list items 的缩进开始。

* list
  * Item one
  * ``` codes here..```

它也没有工作:(不知道为什么。

跳过一行并缩进八个空格。八个空格会触发代码块。

【问题讨论】:

    标签: github readme


    【解决方案1】:

    您需要添加空行以使其与 8 个空格一起使用。现在因为你的item one 已经是 4 个空格,你需要像这样添加 12 个空格(4 + 8 = 12)

    * list
        * item one
    
                codes here..
    

    然后看起来像:

    • 列表
      • 项目一

          codes here..
        

    【讨论】:

      【解决方案2】:
      • 列表
        • 项目一
        • This is
          a code block
          I had to manually indent these lines
          
        • 第三项

      以上是输出

       * List
          * Item one
          * ```
            This is
            a code block
            I had to manually indent these lines
            ```
          * Item three
      

      这有帮助吗?

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-04-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-01-12
        • 1970-01-01
        • 1970-01-01
        • 2017-11-09
        相关资源
        最近更新 更多