【问题标题】:Syntax highlighted code block in markdown indented list paragraph降价缩进列表段落中语法突出显示的代码块
【发布时间】:2020-06-07 16:06:46
【问题描述】:

Markdown 让我可以在列表项下将段落缩进两次以使其成为该列表的一部分。

1. List item

    Paragraph will be rendered inside of list item.

2. Other list item

    Other paragraph.

        This would be code.

3. But what about syntax highlighted code?

    ```bash
    echo "This won't work"
    ```

我还可以缩进两倍来制作代码块。

但是如何在列表段落中使用语法突出显示的代码块,例如 these?有可能吗?

在我的情况下,我使用 mkdocs,一个使用 markdown 的 Python 静态 HTML 生成器。

我之所以问这个问题的背景是因为当您编写分步指南时,这样的列表实际上是一个非常好的设计。

【问题讨论】:

    标签: python markdown mkdocs


    【解决方案1】:

    这个呢:

    3. But what about syntax highlighted code?
    
    ~~~~ bash
    echo "This won't work"
    ~~~~
    

    它在 Firefox 中呈现如下(使用 Stackedit):

    【讨论】:

    • 效果很好,我在您编辑之前在 dillinger 中尝试过,现在也在 stackit 中尝试过。事实上,他们也可以使用 ``` 来渲染我的第一次尝试。所以这现在已经成为一个 mkdocs 问题。感谢您的解决方案并确认降价确实支持这一点!
    猜你喜欢
    • 2015-03-07
    • 2010-11-21
    • 1970-01-01
    • 2012-06-28
    • 2014-09-26
    • 2021-03-06
    • 2014-10-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多