markdown

markdown 组件将 Markdown 内容渲染为经过清理的 HTML。

XML 元素

markdown

Java 类

Markdown

概览

Markdown content

基本用法

markdown 组件支持基本的文本格式、列表、链接以及其他常见的 Markdown 特性。下面的示例中,通过内部的 content 元素提供源文本:

                <markdown>
                    <content>
                        <![CDATA[
# Markdown Sample

This is a sample text that showcases the usage of a Markdown component in Jmix.

## Formatting:
Here is some formatting:

- **Bold text:** Use the `**` to make text **bold**.
- *Italic text:* Use the `*` tag to make text *italic*.

## Lists:
Here are some examples of lists:

### Ordered List:
1. First item
2. Second item
3. Third item

### Unordered List:
- Fruits
  - Apples 🍎
  - Bananas 🍌
  - Oranges 🍊
- Vegetables
  - Carrots
  - Broccoli

## Hyperlinks:
Hyperlinks can be added using the `[text](link)` construction:

[Visit jmix.io](https://www.jmix.io)
                        ]]>
                    </content>
                </markdown>
避免在 content 元素内部的行首添加空格。Markdown 语法对缩进敏感,多余的空格可能会改变标题、列表和代码块的显示效果。

有关 Markdown 的语法,请参考 Markdown 指南。

消息包定义内容

当 Markdown 源码保存在 消息包 时,使用 content 属性。在消息键值前添加 msg://,组件可以解析本地值:

XML
<markdown content="msg://markdown.content"/>
Properties
com.company.onboarding.view.component.markdown/markdown.content=### Welcome to Our App\n\
This is a **markdown** component demonstrating:\n\
- Basic formatting\n\
- List items\n\
- [Links](https://example.com)

XML 属性

下面是 markdown 的特殊属性:

名称 描述 默认值

content

设置 Markdown 的源码,可以直接设置值或设置为消息包的键值。参考 消息包定义内容。

—

下面是 markdown 支持的其他通用属性:

事件和处理器

下面是 markdown 支持的通用事件:

XML 内部元素

一个 markdown 可以包含 content 作为其内部元素,该元素包含 Markdown 源码。

参考