Add icon in alert-block in Jupyter notebook.

huangapple go评论71阅读模式
英文:

Add icon in alert-block in Jupyter notebook

问题

我想在Jupyter notebook的警告块中添加一个警告注释图标。要在Jupyter笔记本中创建一个警告块,我们可以使用以下代码:

<div class="alert alert-block alert-info">
<b>提示:</b> 用蓝色框(alert-info)来表示提示和注释。
如果是注释,您不必包含单词“注释”。
</div>

输出:

Add icon in alert-block in Jupyter notebook.

现在我想添加一个图标。在这个问题中讨论了如何在GitHub的Markdown中添加图标。我们可以使用:warning:语法。不幸的是,这在Jupyter笔记本中不起作用:

<div class="alert alert-block alert-info">
:warning: 用蓝色框(alert-info)来表示提示和注释。
如果是注释,您不必包含单词“注释”。
</div>

输出:

Add icon in alert-block in Jupyter notebook.

如您所见,这不起作用。所以我想知道是否有人知道如何在Jupyter笔记本中为警告块添加图标?

英文:

I would like to add a warning or note icon in an alert-block in Jupyter notebook. To create an alert-block in Jupyter notebook we could use the following code:

&lt;div class=&quot;alert alert-block alert-info&quot;&gt;
&lt;b&gt;Tip:&lt;/b&gt; Use blue boxes (alert-info) for tips and notes. 
If it’s a note, you don’t have to include the word “Note”.
&lt;/div&gt;

Output:

Add icon in alert-block in Jupyter notebook.

Now I could like to add an icon. In this question it is discussed to add icon in markdown in GitHub. We may use then the syntax :warning:. This unfortunately doesn't work in Jupyter notebook:

&lt;div class=&quot;alert alert-block alert-info&quot;&gt;
:warning: Use blue boxes (alert-info) for tips and notes. 
If it’s a note, you don’t have to include the word “Note”.
&lt;/div&gt;

Output:

Add icon in alert-block in Jupyter notebook.

As you can see this doesn't work. So I was wondering if anyone knows how to add an icon to an alert-block in Jupyter notebook?

答案1

得分: 1

只有代码部分不需要翻译,以下是翻译好的内容:

It does work, but that is only a representation of you needing to copy and paste the symbol, hence the '(just copy paste)' note there where you indicated.

Edited version of your code for the markdown to be in the cells:
&gt; ⚠️ **If you are using mobile browser**: Be very careful here
&lt;div class=&quot;alert alert-block alert-info&quot;&gt;
⚠️ Use blue boxes (alert-info) for tips and notes. 
If it’s a note, you don’t have to include the word “Note”.
&lt;/div&gt;
Image of result:

Add icon in alert-block in Jupyter notebook.


Test temporary Jupyter session, with no login needed, provided via the MyBinder service from here.

英文:

It does work, but that is only a representation of you needing to copy and paste the symbol, hence the '(just copy paste)' note there where you indicated.

Edited version of your code for the markdown to be in the cells:
&gt; ⚠️ **If you are using mobile browser**: Be very careful here
&lt;div class=&quot;alert alert-block alert-info&quot;&gt;
⚠️ Use blue boxes (alert-info) for tips and notes. 
If it’s a note, you don’t have to include the word “Note”.
&lt;/div&gt;
Image of result:

Add icon in alert-block in Jupyter notebook.


Test temporary Jupyter session, with no login needed, provided via the MyBinder service from here.

huangapple
  • 本文由 发表于 2023年6月26日 21:53:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/76557342.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定