On this page

chatty-markdown

API chuẩn của element chatty-markdown, sinh từ custom-elements.json của prototype trong guide.

Copy page as MarkdownRead Markdown ↗

Key rules

  • chatty-markdown khai báo 2 attribute, 0 property không có attribute, 0 event, 0 slot, 2 part và 2 CSS custom property.
  • Import 1 module @avada/chatty-ui/elements/markdown.js là define chatty-markdown; chunk chỉ import element nó dùng. Prototype chuẩn: trong guide.
  • Đổi tên attribute, event, slot, part hay CSS custom property là đổi API: diff của custom-elements.json phải có trong 1 MR.
On this page

Overview

Widget markdown rendered as an escaped template tree. Class ChattyMarkdown.

Attributes

Name Property Type Default Description
text text string '' Markdown source; HTML is displayed literally.
animate animate boolean false Holds unfinished inline delimiters during a stream.

Properties

Attributes also expose the properties listed in the Property column above.

Not declared in the manifest.

Events

Not declared in the manifest.

Slots

Not declared in the manifest.

Parts

Name Description
base Markdown document.
link Safe navigation link.

CSS custom properties

Name Default Description
--chatty-markdown-link – Link ink.
--chatty-markdown-code-background – Code background.

Usage

import '@avada/chatty-ui/tokens/tokens.css';
import '@avada/chatty-ui/elements/markdown.js';
<chatty-markdown
  text="## A useful reply&#10;&#10;**Canvas tote** for everyday trips. [Details](https://example.com/products/tote)&#10;&#10;- Lightweight&#10;- Reusable"
></chatty-markdown>

Live preview

Component thật dùng cùng story với trang component; dữ liệu mẫu nằm trong frame cục bộ.

Standard
LightDarkDesktopMobile

Default: trạng thái mặc định và nội dung mẫu của element.

Show code
chatty-markdown.element.jsWrap code linesCopy
<chatty-markdown
  text="## A useful reply&#10;&#10;**Canvas tote** for everyday trips. [Details](https://example.com/products/tote)&#10;&#10;- Lightweight&#10;- Reusable"
></chatty-markdown>

Anatomy

Số trong hình khớp bảng bên dưới. Phần chỉ hiện ở state khác được ghi Not shown; ví dụ không thêm phần tử giả.

Standard
LightDarkDesktopMobile

Anatomy: một instance mặc định riêng, có khoảng trống quanh các phần được đánh số.

Show code
chatty-markdown.element.jsWrap code linesCopy
<chatty-markdown
  text="## A useful reply&#10;&#10;**Canvas tote** for everyday trips. [Details](https://example.com/products/tote)&#10;&#10;- Lightweight&#10;- Reusable"
></chatty-markdown>
Part Element Source
1 CSS part base chatty-ui/custom-elements.json
2 CSS part link chatty-ui/custom-elements.json

Keyboard

No element-specific keys.

Source

  • chatty-ui/custom-elements.json