我正在用markdown写文档。我正在使用神奇的pandoc从markdown源创建docx和tex文件。我想有一个文本框提示和注释的读者编程书籍经常做的方式。我不知道如何做到这一点在markdown。你能帮忙吗?
当前回答
对于同样的问题,我发现的最简单的解决方案是使用一个多行表,只有一行,没有标题(第一列是图像,第二列是文本):
----------------------- ------------------------------------
![Tip](images/tip.png)\ 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。
其他回答
你试过使用双标签吗?做一个盒子:
Start on a fresh line
Hit tab twice, type up the content
Your content should appear in a box
它在带有html输出的常规Rmarkdown文档中为我工作。双选项卡部分应该出现在一个圆角矩形浅灰色框中。
使用GitHub,我通常会插入一个blockquote。
> **_NOTE:_** The note content.
变得……
注:说明内容。
当然,总有简单的HTML…
另一个解决方案是使用CSS邻接并使用h4(或更高):
#### note
This is the note content
h4 {
display: none; /* hide */
}
h4 + p {
/* style the note however you want */
}
这是一个简单的基于乳胶的例子。
---
header-includes:
- \usepackage[most]{tcolorbox}
- \definecolor{light-yellow}{rgb}{1, 0.95, 0.7}
- \newtcolorbox{myquote}{colback=light-yellow,grow to right by=-10mm,grow to left by=-10mm, boxrule=0pt,boxsep=0pt,breakable}
- \newcommand{\todo}[1]{\begin{myquote} \textbf{TODO:} \emph{#1} \end{myquote}}
---
blah blah
\todo{something}
blah
结果是:
不幸的是,因为这是latex,所以你不能再在TODO框中包含markdown(通常这不是一个大问题),并且当转换为PDF以外的格式(例如html)时,它将不起作用。
类似于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 Markdown
- 我如何创建一个文本框的笔记在markdown?
- 在Markdown中创建一个没有标题的表
- R -降价避免包装加载消息
- 在MarkDown中包含SVG(托管在GitHub上)
- 自动TOC在github风味markdown
- 使用pandoc从Markdown转换为PDF时设置空白大小
- 如何显示数学方程在一般github的markdown(不是github的博客)
- 使用Markdown的Sphinx而不是reST
- 降价和图像对齐
- 如何样式一个JSON块在Github维基?
- 标记“本机”文本对齐方式
- Markdown和包括多个文件
- 降价vs加价——它们有关联吗?
- 如何在降价表中编写列表?