在 Markdown 功能块中使用 Markdown

如需在文本功能块中使用 Markdown,请在创建功能块时从信息中心的添加菜单中选择 Markdown文本功能块是一种新型 Looker 文本功能块,不使用 Markdown,而是提供可视化编辑体验

您可以在信息中心内使用文本图块来描述其他图块,并帮助观看者了解这些图块显示的信息。Looker 的 Markdown 功能块在文本功能块中支持有限版本的 Markdown 标记语言,可让您选择设置文本格式或添加链接和图片,从而让信息中心更加醒目。

Markdown 功能块支持的 Markdown 语法

本页面列出了 Markdown 功能块支持的 Markdown 语法,每个示例都先以代码块的形式显示,然后再显示其结果。

在信息中心功能块中呈现的 Markdown 元素的样式可能与此处显示的样式不同。

标头

信息中心支持标题级别 1-6:

## Header level 1

### Header level 2

#### Header level 3

##### Header level 4

###### Header level 5

####### Header level 6

表格列的大小会根据最宽的数据值而定。您可以使用   为列添加宽度。

| Tables        | Are           | Cool  |
| ------------- | ------------- | ----- |
| leopards      | have spots    | $1600 |
| zebras        | have stripes      | $12   |
| polar bears        | are white     | $1    |

显示 Markdown 表格的文本功能块。

表格列仅支持左对齐。

强调

Emphasis (italics) with *asterisks* or _underscores_.

Strong emphasis (bold) with **double asterisks** or __double underscores__.

Combined emphasis with **asterisks and _underscores_**.

显示粗体字体和斜体文本的文本功能块。

编号列表

1. First ordered list item
1. Another item
1. Actual numbers don't matter, just that it's a number
1. And another item

显示编号列表的文本功能块。

无序列表

* Unordered lists can use asterisks
- or minuses
+ or pluses

显示无序列表的文本功能块。

您可以通过多种方式添加链接,如下方 Markdown 所示:

[Inline-style link](https://www.looker.com)
[Reference-style link](Case-insensitive reference text)
[Relative reference to a public repository](../assets/images/dashboard-add-text.png)
[Number used for a reference-style link definition][1]

尖括号中的网址会自动转换为链接。例如,<looker.com>looker.com

图片

图片可以通过路径或网址进行引用。

Here's our logo:

URL-style:

<img src="url/to/image.png">

Inline-style:

![alt text](path/to/image.png)

Reference-style:

![alt text][logo]


文本功能块显示了三种方式引用的 Google Cloud 徽标。

如需控制图片相对于图块大小的大小,请使用 HTML 调用图片并添加百分比大小参数。以下示例使用 width="50%" 参数更改大小:


<img src="path/to/image.png" width="50%">

将 Google Cloud 徽标的宽度设为 50%。

或者,您也可以提供明确的最大高度和宽度,如下所示:


<img src="path/to/image.png" width="500px" height="30px">

将 Google Cloud 徽标的宽度设置为 500 像素。

高度和宽度像素参数不会将图片设置为这些确切尺寸;相反,图片的宽高比将“最适合”这些约束条件。例如,如果为原始尺寸为 200 像素 x 20 像素的图片设置尺寸“width=100px height=30px”,则结果将为 100 像素 x 10 像素,因为大致逻辑为“图片宽度超出上限 > 缩小,直到宽度达到上限”。

代码突出显示

`<script>Some code</script>.`

以代码字体样式显示代码的文本功能块。

水平规则

Three or more hyphens

---

Asterisks

***

Underscores

___

显示文本和水平规则的文本功能块。


引用

> Blockquotes are very handy.
> This line is part of the same quote.

显示引用文本的文字功能块。

引号换行

> This is a very long line that will be quoted properly when it wraps. I will keep writing to make sure this is long enough to actually wrap for everyone. Also, you can *put* **Markdown** into a blockquote.

显示长引号块的文本功能块。

不支持的 Markdown 语法

信息中心 Markdown 功能块不支持以下 Markdown 语法:

  • 数学
  • 带有替代文本的图片
  • 带替代文本的链接
  • 特定于语言的语法突出显示
  • 使用两个波浪符号添加删除线
  • 子名单
  • 缩进