Python markdown 的两个块引号中的代码片段
Python code snippet in two blockquotes of markdown
我正在尝试在 Markdown 的块引用中编写两个代码片段(JupyterLab,如果这有什么不同的话)。这是一个最小的例子:
> ```python
test = [12, 15, 20]
test
```
yields
> ```python
[12, 15, 20]
```
当我 运行 它时,我没有得到两个块引用。这是我得到的输出:
我这里的错误是什么?
我必须亲自去尝试一下...
你必须明确地告诉 Jupyter 你想要一个 Markdown 单元格:
告诉Jupyter你在一个Markdown单元格中之后,你可以轻松实现你想要的:
编辑:我误解了你的问题。带块引号:
> ```python
> test = [12, 15, 20]
> test
> ```
yields
> ```python
> [12, 15, 20]
> ```
另请参阅 this question 了解更多信息。
用 >
个字符作为整个块引用的前缀:
> ```python
> test = [12, 15, 20]
> test
> ```
yields
> ```python
> [12, 15, 20]
> ```
是的,这有点难打字,但可以正确呈现:
这也符合 one of Markdown's original design goals:
The idea is that a Markdown-formatted document should be publishable as-is, as plain text, without looking like it's been marked up with tags or formatting instructions.
为整个块引用添加前缀使其看起来像一个块引用,即使在其源格式中也是如此。
请注意,我还在“yields”之前添加了一个空行,因为这也有助于源代码的可读性。它还从 blockquote 中删除了“yields”。如果“yields”应该在 blockquote 中,您可以简单地添加更多 >
个字符:
> ```python
> test = [12, 15, 20]
> test
> ```
>
> yields
我正在尝试在 Markdown 的块引用中编写两个代码片段(JupyterLab,如果这有什么不同的话)。这是一个最小的例子:
> ```python
test = [12, 15, 20]
test
```
yields
> ```python
[12, 15, 20]
```
当我 运行 它时,我没有得到两个块引用。这是我得到的输出:
我这里的错误是什么?
我必须亲自去尝试一下...
你必须明确地告诉 Jupyter 你想要一个 Markdown 单元格:
告诉Jupyter你在一个Markdown单元格中之后,你可以轻松实现你想要的:
编辑:我误解了你的问题。带块引号:
> ```python
> test = [12, 15, 20]
> test
> ```
yields
> ```python
> [12, 15, 20]
> ```
另请参阅 this question 了解更多信息。
用 >
个字符作为整个块引用的前缀:
> ```python
> test = [12, 15, 20]
> test
> ```
yields
> ```python
> [12, 15, 20]
> ```
是的,这有点难打字,但可以正确呈现:
这也符合 one of Markdown's original design goals:
The idea is that a Markdown-formatted document should be publishable as-is, as plain text, without looking like it's been marked up with tags or formatting instructions.
为整个块引用添加前缀使其看起来像一个块引用,即使在其源格式中也是如此。
请注意,我还在“yields”之前添加了一个空行,因为这也有助于源代码的可读性。它还从 blockquote 中删除了“yields”。如果“yields”应该在 blockquote 中,您可以简单地添加更多 >
个字符:
> ```python
> test = [12, 15, 20]
> test
> ```
>
> yields