我正在用markdown写文档。我正在使用神奇的pandoc从markdown源创建docx和tex文件。我想有一个文本框提示和注释的读者编程书籍经常做的方式。我不知道如何做到这一点在markdown。你能帮忙吗?


当前回答

你试过使用双标签吗?做一个盒子:

Start on a fresh line
Hit tab twice, type up the content
Your content should appear in a box

它在带有html输出的常规Rmarkdown文档中为我工作。双选项卡部分应该出现在一个圆角矩形浅灰色框中。

其他回答

我通常在标记文本中放置警告框(例如,注意或警告)(不仅在使用pandoc时,而且在任何支持标记的地方)是用两条水平线围绕内容:

---
**NOTE**

It works with almost all markdown flavours (the below blank line matters).

---

大概是这样的:


NOTE

它适用于所有降价的口味(下面的空白行很重要)。


好消息是你不需要担心哪个降价风味是支持的,或者安装或启用了哪个扩展。

编辑:正如@filups21在评论中提到的,在RMarkdown中,一条水平线似乎是由***表示的。所以,之前提到的解决方案并不像最初声称的那样适用于所有廉价口味。

你试过使用双标签吗?做一个盒子:

Start on a fresh line
Hit tab twice, type up the content
Your content should appear in a box

它在带有html输出的常规Rmarkdown文档中为我工作。双选项卡部分应该出现在一个圆角矩形浅灰色框中。

类似于Etienne的解决方案,一个简单的表格格式很好:

| | |
|-|-|
|`NOTE` | This is something I want you to notice. It has a lot of text, and I want that text to wrap within a cell to the right of the `NOTE`, instead of under it.|

另一种选择(更强调)是将内容作为无主体表的头:

|`NOTE` | This is something I want you to notice. It has a lot of text, and I want that text to wrap within a cell to the right of the `NOTE`, instead of under it.|
|-|-|

最后,你可以添加一条水平线(主题断线)来创建一个封闭的方框(尽管线条样式与表中的标题行略有不同):

| | |
|-|-|
|`NOTE` | This is something I want you to notice. It has a lot of text, and I want that text to wrap within a cell to the right of the `NOTE`, instead of under it.|

---

注意文本后面的空行。

使用GitHub,我通常会插入一个blockquote。

> **_NOTE:_**  The note content.

变得……

注:说明内容。

当然,总有简单的HTML…

你也可以使用https://www.npmjs.com/package/markdown-it-container

::: warning
*here be dragons*
:::

然后渲染为:

<div class="warning">
<em>here be dragons</em>
</div>