我正在降价处写一份文件.我正在使用精彩的pandoc从markdown源创建docx和tex文件.我希望有一个文本框,可以为读者提供编程书籍常用的方法.我无法弄清楚如何在降价时这样做.你能帮我吗?
car*_*ist 47
我通常用于在降价文本中放置警告框(例如注释或警告)(不仅在使用pandoc时,而且在每个支持降价的地方)都使用两条水平线包围内容:
---
**NOTE**
It works with almost all markdown flavours (the below blank line matters).
---
Run Code Online (Sandbox Code Playgroud)
这将是这样的:
注意
它适用于所有降价口味(下面的空白行很重要).
好消息是您不必担心支持哪种降价风格或安装或启用了哪种扩展名.
编辑:正如@ filups21在评论中提到的,似乎水平线***在RMarkdown中表示.因此,之前提到的解决方案不适用于最初声明的所有降价口味.
Vla*_*lad 32
使用GitHub,我通常会插入一个blockquote
注意: 注释内容.
当然,总是有简单的HTML ...
rah*_*uja 22
截至 2021 年 9 月:这是使用 html div 标签和类 'warning'
在 Markdown 中构建文本框的一种方法。它在Jupyter Notebook和Typora中运行良好。您可以修改背景和字体颜色。
<div class="warning" style='padding:0.1em; background-color:#E9D8FD; color:#69337A'>
<span>
<p style='margin-top:1em; text-align:center'>
<b>On the importance of sentence length</b></p>
<p style='margin-left:1em;'>
This sentence has five words. Here are five more words. Five-word sentences are fine. But several together bocome monotonous. Listen to what is happening. The writing is getting boring. The sound of it drones. It's like a stuck record. The ear demands some variety.<br><br>
Now listen. I vary the sentence length, and I create music. Music. The writing sings. It has a pleasent rhythm, a lilt, a harmony. I use short sentences. And I use sentences of medium length. And sometimes when I am certain the reader is rested, I will engage him with a sentence of considerable length, a sentence that burns with energy and builds with all the impetus of a crescendo, the roll of the drums, the crash of the cymbals -- sounds that say listen to this, it is important.
</p>
<p style='margin-bottom:1em; margin-right:1em; text-align:right; font-family:Georgia'> <b>- Gary Provost</b> <i>(100 Ways to Improve Your Writing, 1985)</i>
</p></span>
</div>
Run Code Online (Sandbox Code Playgroud)
或者(在设计中添加更多内容 - 圆角和边框)
<div class="warning" style='background-color:#E9D8FD; color: #69337A; border-left: solid #805AD5 4px; border-radius: 4px; padding:0.7em;'>
<span>
<p style='margin-top:1em; text-align:center'>
<b>On the importance of sentence length</b></p>
<p style='margin-left:1em;'>
This sentence has five words. Here are five more words. Five-word sentences are fine. But several together bocome monotonous. Listen to what is happening. The writing is getting boring. The sound of it drones. It's like a stuck record. The ear demands some variety.<br><br>
Now listen. I vary the sentence length, and I create music. Music. The writing sings. It has a pleasent rhythm, a lilt, a harmony. I use short sentences. And I use sentences of medium length. And sometimes when I am certain the reader is rested, I will engage him with a sentence of considerable length, a sentence that burns with energy and builds with all the impetus of a crescendo, the roll of the drums, the crash of the cymbals -- sounds that say listen to this, it is important.
</p>
<p style='margin-bottom:1em; margin-right:1em; text-align:right; font-family:Georgia'> <b>- Gary Provost</b> <i>(100 Ways to Improve Your Writing, 1985)</i>
</p></span>
</div>
Run Code Online (Sandbox Code Playgroud)
kot*_*ane 15
以下方法适用于 GitHub、GitLab... 和Stackoverflow,现在使用CommonMark!
> 用 Blockquote 制作的单线框
用 Blockquote 制作的单线框
`用反引号制作的单行框`
One-Line Box made with Backticks
```
用三重反引号制作的盒子
```
Box made with Triple Backticks
Run Code Online (Sandbox Code Playgroud)
~ ~ ~
用三重波浪号制成的盒子 (去除波浪号之间的空格以使其工作)
~~~
Box made with Triple Tildes
Run Code Online (Sandbox Code Playgroud)
在每行开头用四个空格组成的框:
“Sometimes we must let go of our pride and do what is requested of us.”
Padmé Amidala
Run Code Online (Sandbox Code Playgroud)
...或使用水平线?
三个破折号 (---) 构成一条水平线:
注意:“你的焦点决定你的现实。” – 奎刚金。
对于更多配置,我强烈建议优秀的GitLab Markdown Guide。
您还可以查看不太详细的GitHub 基本格式语法。
您可以使用Babelmark比较 Markdown 实现。
有用的提示:
要强制换行,请在行尾放置两个空格;
要转义特殊字符,请使用 \。
Eti*_*ard 13
我发现完全相同问题的最简单的解决方案是使用一行多行表而没有标题(第一列中有图像,第二列中有文本):
----------------------- ------------------------------------
\ Table multiline text bla bla bla bla
bla bla bla bla bla bla bla ... the
blank line below is important
----------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)
另一种可行的方法(对于PDF)是使用Latex默认的fbox指令:
\fbox{My text!}
Run Code Online (Sandbox Code Playgroud)
或者FancyBox模块用于更高级的功能(以及更好看的盒子):http://www.ctan.org/tex-archive/macros/latex/contrib/fancybox .
类似于 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.|
Run Code Online (Sandbox Code Playgroud)
另一种选择(更强调)是使内容成为无正文表的标题:
|`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.|
|-|-|
Run Code Online (Sandbox Code Playgroud)
最后,您可以包含一条水平线(主题中断)来创建一个封闭的框(尽管线型与表格中的标题线略有不同):
| | |
|-|-|
|`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.|
---
Run Code Online (Sandbox Code Playgroud)
注意文本后面的空行。
我通常插入一个块引用并在其中添加一个 Unicode 字符(备忘录是(U+1F4DD))。
...
| 句法 | 演示 |
|---|---|
> bla bla ... |
|
> ```` bla bla |
|
> ** bla bla |
|
当然,如果你不喜欢你可以搜索你喜欢的。相信一定会有一款让您满意的!
查找更多表情符号:https : //emojipedia.org/
只需搜索你喜欢的图标并复制粘贴然后完成(因为它是一个字符,所以它适用于每个设备)
如果您不喜欢复制粘贴并想自己键入,则可以考虑搜索 Unicode。
ps 也可以关注emoji版本(一般和Unicode版本一样),以后可能会出现更多让你满意的图标。
使用admonition扩展程序.对于mkdocs,可以在mkdocs.yml文件中配置:
markdown_extensions:
- admonition
Run Code Online (Sandbox Code Playgroud)
然后在您的md文件中插入注释,如下所示:
!!! note
This is a note.
Run Code Online (Sandbox Code Playgroud)
在这里查看示例.
小智 6
您是否尝试过使用双标签?做一个盒子:
Start on a fresh line
Hit tab twice, type up the content
Your content should appear in a box
Run Code Online (Sandbox Code Playgroud)
它在带有 html 输出的常规 Rmarkdown 文档中对我有用。双标签部分应出现在圆角矩形浅灰色框中。
您也可以使用https://www.npmjs.com/package/markdown-it-container
::: warning
*here be dragons*
:::
Run Code Online (Sandbox Code Playgroud)
然后将呈现为:
<div class="warning">
<em>here be dragons</em>
</div>
Run Code Online (Sandbox Code Playgroud)
这是一个基于乳胶的简单示例。
---
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
Run Code Online (Sandbox Code Playgroud)
不幸的是,由于这是乳胶,因此您不能再在TODO框内添加markdown(通常这不是一个大问题),并且在转换为PDF(例如html)以外的格式时将无法使用。
另一个解决方案是使用CSS邻接并使用h4(或更高版本):
#### note
This is the note content
Run Code Online (Sandbox Code Playgroud)
#### note
This is the note content
Run Code Online (Sandbox Code Playgroud)
> hello
> world
Run Code Online (Sandbox Code Playgroud)
你好世界
> hello
>
> world (new line)
Run Code Online (Sandbox Code Playgroud)
你好
世界(新线)
> ```shell
> echo hello
> echo world
> ```
Run Code Online (Sandbox Code Playgroud)
Run Code Online (Sandbox Code Playgroud)> hello > world
| 归档时间: |
|
| 查看次数: |
45086 次 |
| 最近记录: |