feat(md-font): Add color attribute

This commit is contained in:
hyper 2026-06-30 18:37:46 +08:00
parent fa57727abb
commit 548d6a0510
2 changed files with 40 additions and 1 deletions

View File

@ -1,4 +1,4 @@
:md-font[Pacifico]{source=google} hello? :md-font[Pacifico]{source=google color=crimson} hello?
:md-dice[d6]{.bg-amber-100} :md-dice[d6]{.bg-amber-100}
:md-border[crimson]{.b} :md-border[crimson]{.b}

View File

@ -201,6 +201,45 @@
# 红色背景 # 红色背景
``` ```
### 🔤 字体组件 (md-font)
```markdown
:md-font[Noto Sans SC]{source="google" weight="700" color="#ff00dd"}
:md-font[LXGW WenKai]{source="emfont"}
:md-font[Arial]{source="local"}
```
**功能:**
- 设置当前文章卡片的字体
- 支持从 Google Fonts、emfont 或本地加载字体
- 支持设置字体颜色
**属性:**
| 属性 | 类型 | 默认值 | 说明 |
|------|------|--------|------|
| `source` | `google` \| `emfont` \| `local` | `local` | 字体来源 |
| `weight` | string | `400` | 字体粗细 |
| `color` | string | - | 字体颜色CSS 颜色值,如 `#ff00dd`、`rgb(255,0,0)` |
**示例:**
```markdown
:md-font[Noto Sans SC]{source="google" weight="400"}
# 标题文本
这里是正文内容,使用 Noto Sans SC 字体。
:md-font[Noto Sans SC]{source="google" weight="400" color="#1a1a2e"}
# 深色文字
:md-font[Noto Sans SC]{source="google" weight="700" color="crimson"}
# 红色粗体标题
```
### 📍 标记组件 (md-pins) ### 📍 标记组件 (md-pins)
```markdown ```markdown