在 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

将表格列的大小调整为最宽的数据值。您可以使用   为列添加宽度。

| 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">

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

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

代码突出显示

`<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 语法:

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