在 Zeppelin 中,您可以使用这样的 html 来获取粗体文本:
print( '%html <b> hello </b>')
你好
在第一个引号后以“%html”开头,然后你可以使用html语法直到第二个引号。
对于那些还没有大量使用 HTML 的人,这里有更多 HTML 基础知识以及如何在 %pyspark - Zeppelin 单元中使用它们:
其他文字样式
print('%html <strong>important</strong>')
print('%html <i>italic</i>')
print('%html <del>striked through</del>')
print('%html <sub>low</sub>')
print('%html <sup>high</sup>')
为:
重要
斜体
划线
低高
以下内容在 Zeppelin 中也同样有效,但我现在无法展示它:
print('%html <ins>underlined</ins>')
print('%html <mark>marked</mark>')
print('%html <small>small</small>')
您可以将 h1、h2、...、h6 用于标题:
print('%html <h1>Heading 1</h1>')
标题 1
无序或有序列表:
print( '%html <ul> <li>something</li> <li>anything</li> </ul> ')
print( '%html <ol> <li>first</li> <li>second</li> </ol> ')
- 第一
- 第二
链接:
print('%html print <a href="https://www.stackoverflow.com">This is a link to stackoverflow.com</a> ')
This is a link to stackoverflow.com
将鼠标移到原始单词上时出现的缩写或信息文本。
print('%html <p><abbr title="Hypertext Markup Language">HTML</abbr> is the standard markup language for creating web pages and web applications.</p>')
你可以在 Zeppelin 中尝试一下。
文字颜色
例如基于 rgb 颜色空间,其中 r,g,b 是颜色中红色、绿色和蓝色的数量:
print('%html <p style="color:rgb(255, 0, 0);">red</p>')
print('%html <p style="color:rgb(0, 255, 0);">green</p>')
print('%html <p style="color:rgb(0, 0, 255);">blue</p>')
Some examples for color codes
您也可以为背景着色:
print('%html <p style="background-color:rgb(255, 0, 0);">Background is red</p>')