halo-render/doc/general.md

30 lines
951 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 📄 语法设计
## 类型标识
解析器使用输入文本的第一行来标识渲染的类型,当前支持下面几种类型:
- `tips` 提供多彩的提示组件
- `git` 提供Git仓库信息的组件
- `drive` 提供资源下载的组件
渲染类型标识可以在后方加入一些子类型或配置信息,格式如下:
```plaintext
<type>:<option | sub_type>
```
例如tips组件在后方标识了子类型如`tips:danger`则表示使用`tips`解析器解析为danger样式。
git组件则在后方标识了一组配置如`git:[@github/justice2001/halo-plugin-vditor]`
具体的行为可以由解析器来自定义。
## 内容
从第二行起至最后一行,均为内容部分,这一部分会被作为整体传入到解析器中,解析器可以根据需要来设计语法。
如`drive`组件则在此处处理附加的长配置信息。
而`tips`则会将此部分内容解析为html附加到内容中。