我正在用markdown写文档。我正在使用神奇的pandoc从markdown源创建docx和tex文件。我想有一个文本框提示和注释的读者编程书籍经常做的方式。我不知道如何做到这一点在markdown。你能帮忙吗?
当前回答
类似于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.|
---
注意文本后面的空行。
其他回答
对于同样的问题,我发现的最简单的解决方案是使用一个多行表,只有一行,没有标题(第一列是图像,第二列是文本):
----------------------- ------------------------------------
\ Table multiline text bla bla bla bla
bla bla bla bla bla bla bla ... the
blank line below is important
----------------------------------------------------------------
另一种可能工作(PDF)的方法是使用Latex默认的fbox指令:
\fbox{My text!}
或FancyBox模块获得更高级的功能(和更好看的盒子):http://www.ctan.org/tex-archive/macros/latex/contrib/fancybox。
使用警告扩展。对于mkdocs,可以在mkdocs中配置。yml文件:
markdown_extensions:
- admonition
然后在md文件中插入注释,如下所示:
!!! note
This is a note.
这里有一个例子。
以下方法工作在GitHub,在GitLab…在Stackoverflow上,现在使用CommonMark!
>用Blockquote制作的一行盒子
用Blockquote制作的单行盒子
“用反划线制作的单行框”
单行盒与反刻度
' ' ' 盒子与三反tick ' ' '
Box made with Triple Backticks
~ ~ ~ 用三个波浪线制作的盒子(删除波浪线之间的空间以使其工作) ~ ~ ~
Box made with Triple Tildes
每行开头有四个空格的方框:
“Sometimes we must let go of our pride and do what is requested of us.”
Padmé Amidala
... 还是用水平线?
三个破折号(——)组成一条水平线:
注意:“你的专注决定了你的现实。——奎刚·金。
对于更多的配置,我强烈推荐优秀的GitLab Markdown指南。 你也可以检查不太详细的GitHub基本格式语法。 您可以使用Babelmark比较Markdown实现。
有用提示:
要强制换行,在行尾放置两个空格; 要转义特殊字符,使用\。
类似于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.|
---
注意文本后面的空行。
我通常在标记文本中放置警告框(例如,注意或警告)(不仅在使用pandoc时,而且在任何支持标记的地方)是用两条水平线围绕内容:
---
**NOTE**
It works with almost all markdown flavours (the below blank line matters).
---
大概是这样的:
NOTE
它适用于所有降价的口味(下面的空白行很重要)。
好消息是你不需要担心哪个降价风味是支持的,或者安装或启用了哪个扩展。
编辑:正如@filups21在评论中提到的,在RMarkdown中,一条水平线似乎是由***表示的。所以,之前提到的解决方案并不像最初声称的那样适用于所有廉价口味。
推荐文章
- 如何将LaTeX与Markdown混合?
- 乳胶渲染在README。md在Github上
- 在Markdown Jekyll中使用图像说明
- Slack Markdown链接没有解决
- 差异语法突出显示在Github Markdown
- 我如何创建一个文本框的笔记在markdown?
- 在Markdown中创建一个没有标题的表
- R -降价避免包装加载消息
- 在MarkDown中包含SVG(托管在GitHub上)
- 自动TOC在github风味markdown
- 使用pandoc从Markdown转换为PDF时设置空白大小
- 如何显示数学方程在一般github的markdown(不是github的博客)
- 使用Markdown的Sphinx而不是reST
- 降价和图像对齐
- 如何样式一个JSON块在Github维基?