Markdown
DataLens allows you to use the Markdown markup language in the Text widget on the dashboard.
You can insert explanatory text, links, tables, images, or use formatting to highlight key points.
In text widgets, you can use the following elements:
Headers
You can use four levels of headings in the widget.
Use #
to mark up headings.
Syntax example:
# Level 1 heading
## Level 2 heading
### Level 3 heading
#### Level 4 heading
Highlighting text
Use formatting to highlight key points in your text:
-
To make text bold, use double
*
:This text will be **bold**.
-
To make text italic, use
_
:This text will be _italic_.
-
To combine bold and italics, use double
*
and_
at the same time:This text will be _**bold and italic**_. This text will be **_bold and italic_**.
Text color
You can set the text color this way: {color}(text)
. The following colors are supported:
- gray
- yellow
- orange
- red
- green
- blue
- violet
For example, the following markup:
This text is {green}(green).
will be displayed as:
This text is green.
Lists
You can use multiple list types to arrange the data on the dashboard.
Simple unordered list
To make an unordered bulleted list, use characters such as *
, -
, or +
.
For example, the following markup:
* Item 1
* Item 2
* Item 3
will be displayed as:
- Item 1
- Item 2
- Item 3
Nested unordered list
To make a nested unordered list, add an indent for the lines with the nested list items. The indent can be from two to five spaces.
For example, the following markup:
- Item 1
- Item A
- Item B
- Item 2
will be displayed as:
- Item 1
- Item A
- Item B
- Item 2
Simple ordered list
To make an ordered list, use numbers with a .
or )
symbol.
For example, the following markup:
1. First item
1. Second item
1. Third item
will be displayed as:
- First item
- Second item
- Third item
Nested ordered list
To make a nested ordered list, add an indent for the lines with the nested list items. The indent can be from three to six spaces.
For example, the following markup:
1. First item
1. Nested item
1. Nested item
1. Second item
will be displayed as:
-
First item
1.1. Nested item
1.2 Nested item -
Second item
Tables
A table consists of a single row with headers, a separator row, and rows with data.
Each row in a table consists of cells that are separated from each other by a |
.
The cells of the separator row only allow the -
character and :
character. The colon (:
) is used at the beginning, end, or on both sides of the cell content of the separator row to indicate left, right, or center alignment of text in the corresponding column, respectively.
A table should be separated from the surrounding text with empty lines.
For example, the following markup:
Left-aligned | Right-aligned | Centered
:--- | ---: | :---:
Text | Text | Text
will be displayed as:
Left-aligned | Right-aligned | Centered |
---|---|---|
Text | Text | Text |
To add a line break or a more complex element (such as a list or code block) to a table cell, use an alternative markup:
#|
|| **Header1** | **Header2** ||
|| Text | Text ||
|#
Sample markup with line breaks and a list:
#|
||Text
on two lines
|
- Item 1
- Item 2
- Item 3
- Item 4||
|#
See more in the YFM documentation
Links
You can use links to enter information related to the dashboard or charts.
For example, you can add links to other dashboards and specify data sources.
A link consists of two parts:
[text]
: Link text(link)
: URL or path to the referenced file
For example, the following markup:
[link to yandex.ru](https://yandex.ru).
will be displayed as:
Code formatting
You can use inline code snippets or code blocks.
Inline code snippet
Use `
to format inline code snippets.
For example, the following markup:
A sentence with a `code snippet`.
will be displayed as:
A sentence with a code snippet
.
Code block
Use triple `
and the programming language name to format your snippet as a code block.
For example, the following markup:
```kotlin
val a: Int = 1
```
will be displayed as a highlighted Kotlin code snippet:
val a: Int = 1
Image
You can add images from the Yandex Object Storage storage to the widget. To learn more about the service pricing plans, see Object Storage pricing policy. Images from external sources are not supported.
You can add images of any format using object links in https://storage.yandexcloud.net/<bucket>/<key>
format.
To upload an image from Object Storage to a widget:
-
Open the management console
. -
In the top-left corner, click
and select Object Storage. -
Upload the image to the bucket.
-
Go to the object you got and click Get link.
-
Specify link lifetime and copy the link.
Warning
When the specified lifetime expires, the image will become unavailable (30 days maximum).
-
Open the dashboard in DataLens and create a Text widget.
-
Paste the following code in the widget:
![alt text](https://link_to_image "Text for tip on hover" =100x200)
How to create a permanent link
For the uploaded image to be permanently available, open access to it via an ACL object.
Warning
Public access to the file is granted to an unlimited number of anonymous users. For more information about methods of access management in Object Storage, see the documentation.
-
Open the management console
. -
In the top-left corner, click
and select Object Storage. -
Create a bucket. When selecting a bucket name, use these recommendations.
-
Upload the image to the bucket.
-
Configure an ACL for the object you created:
- Click
to the right of the object name and select Object ACL. - Grant the
READ
permission to theallUsers
group.
- Click
-
Make a link to the object in the bucket in
https://storage.yandexcloud.net/<bucket>/<key>
format, where:<bucket>
: Bucket name.<key>
: Object key (file path).
-
Open the dashboard in DataLens and create a Text widget.
-
Paste the following code in the widget:
![alt text](https://link_to_image "Text for tip on hover" =100x200)