# 文本

单个文本模块至少应添加一个子节点，最多支持 **3个** 子节点。

子节点共有三种类型
1. 文本类节点
2. 图片类节点
3. 按钮类节点

其中文本类节点支持普通文本和`markdown`富文本；当是`markdown`时，同时也支持`HTML`格式插入。例如：

![image.png](https://api.apifox.com/api/v1/projects/5440720/resources/543377/image-preview)

共支持以下五种排列方式:
1. 文本节点 + 文本节点
2. 文本节点 + 文本节点 + 文本节点
3. 文本节点 + 按钮节点
4. 文本节点 + 图片节点
5. 图片节点 + 文本节点

## 数据结构

```typescript
interface TextNode {
  type: 'plain-text' | 'markdown';
  text: string;
}
interface ButtonNode {
  type: 'button';
  event: 'link-to' | 'server' | 'internal' | 'none';
  value: string;
  text: string;
  theme: 'default' | 'primary' | 'success' | 'danger';
  style: string; // CSS拼接字符串，例如：color: red; width: 200px;
}
interface SectionImageNode {
  type: 'image';
  url: string;
  size: 'large' | 'medium' | 'small';
}

interface MdSection {
  type: 'section',
  paragraph: (TextNode | ButtonNode | SectionImageNode)[]
}
```

```
{
  "type": "section",
  "paragraph": [
    {
      "type": "image",
      "url": "https:/*.max-c.com/xxxx", // 在媒体接口中上传的图片地址
      "size": "large/medium/small"
    },
    {
      "text": "文本内容",
      "type": "plain-text/markdown"
    },
    {
      "type": "button",
      "text": "按钮文本",
      "event": "server",
      "value": "按钮值",
      "theme": "primary"
    }
  ]
}
```
