在降价单元格中添加自定义样式的段落 [英] Adding custom styled paragraphs in markdown cells
问题描述
我想添加的格式元素要比
I want to add more formatting elements than provided by the Markdown synthax in an IPython Notebook.
例如,我要添加基本上是具有不同样式(例如,不同的背景颜色,边框,图标等)的段落的警告框"或备注框".
For example, I want to add a "Warning Box" or a "Memo Box" that are basically paragraph with different styles (for example different background color, border, an icon, etc...).
我想我可以在单元格中添加HTML代码,例如具有内联样式的<div>
.但是,执行此操作的正确"方法是什么?我的意思是ipython开发人员推广的方法?
I guess I can add HTML code in the cell, for example a <div>
with an inline style. But what is the "proper" way to do that, I mean the one that ipython developer promote?
赞赏的例子.
注意::我使用的是git master的当前1.0dev版本.
NB: I'm using the current 1.0dev version from git master.
推荐答案
添加警告,注释,成功(例如...)框(也称为警告框或警报框)的简单方法是使用引导类.唯一需要注意的是,必须在框中的HTML中指定链接和其他样式(例如,粗体).
A simple way to add warning, note, success (etc...) boxes (also called admonition or alert boxes) is simply using the bootstrap classes already included with the notebook. The only caveat is that links and other styles (e.g. bold) must be specified in HTML inside the box.
包含以下代码的降价单元格:
A markdown cell containing this code:
# Upload data files
<p class="lead">This <a href="https://jupyter.org/">Jupyter notebook</a>
shows how to upload data files to be converted
to [Photon-HDF5](http://photon-hdf5.org) format. </p>
<i>Please send feedback and report any problems to the
[Photon-HDF5 google group](https://groups.google.com/forum/#!forum/photon-hdf5).</i>
<br>
<div class="alert alert-warning">
<b>NOTE</b> Uploading data files is only necessary when running the notebook online.
</div>
将得到以下输出:
您可以使用alert-success
,alert-info
或alert-danger
更改alert-warning
,以使包装盒获得不同的颜色.
You can change alert-warning
with alert-success
, alert-info
or alert-danger
to get different colors for the box.
这篇关于在降价单元格中添加自定义样式的段落的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!