fix: rm other attr
This commit is contained in:
@@ -1,28 +1,76 @@
|
||||
# MathML 导入 Word 完整指南
|
||||
|
||||
## MathML 简化优化 ✨
|
||||
|
||||
我们的 MathML 输出已经过深度优化,相比标准 Pandoc 输出更加**简洁、高效、Word 兼容**。
|
||||
|
||||
### 自动移除的冗余元素
|
||||
|
||||
✅ **结构简化**
|
||||
- 移除 `<semantics>` 包装器(Word 不需要)
|
||||
- 移除 `<annotation>` 元素(仅用于调试)
|
||||
- 移除冗余的单层 `<mrow>` 包装
|
||||
|
||||
✅ **属性简化**
|
||||
- 移除 `form="prefix/infix/postfix"` 属性
|
||||
- 移除 `stretchy="true/false"` 属性
|
||||
- 移除 `fence="true/false"` 属性
|
||||
- 移除 `separator="true/false"` 属性
|
||||
- 移除 `columnalign`、`columnspacing`、`rowspacing` 等表格属性
|
||||
- 移除 `class` 和 `style` 属性(Word 不支持)
|
||||
|
||||
✅ **内容优化**
|
||||
- Unicode 实体 → 实际字符(如 `γ` → `γ`)
|
||||
- `display="inline"` → `display="block"`(更好的渲染效果)
|
||||
- 清理额外的空白字符
|
||||
|
||||
### 简化效果对比
|
||||
|
||||
**简化前(标准 Pandoc 输出):**
|
||||
```xml
|
||||
<math display="inline" xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<semantics>
|
||||
<mrow>
|
||||
<mi>γ</mi>
|
||||
<mo form="infix">=</mo>
|
||||
<mn>22</mn>
|
||||
<mo form="infix">.</mo>
|
||||
<mn>2</mn>
|
||||
</mrow>
|
||||
<annotation encoding="application/x-tex">\gamma = 22.2</annotation>
|
||||
</semantics>
|
||||
</math>
|
||||
```
|
||||
长度:~280 字符
|
||||
|
||||
**简化后(我们的输出):**
|
||||
```xml
|
||||
<math display="block" xmlns="http://www.w3.org/1998/Math/MathML">
|
||||
<mi>γ</mi><mo>=</mo><mn>22</mn><mo>.</mo><mn>2</mn>
|
||||
</math>
|
||||
```
|
||||
长度:~120 字符
|
||||
|
||||
**减少约 60% 的冗余!** 🎉
|
||||
|
||||
---
|
||||
|
||||
## 问题诊断
|
||||
|
||||
如果 MathML 无法在 Word 中渲染,通常是以下原因:
|
||||
|
||||
### 1. **MathML 格式问题**
|
||||
- ❌ 包含 `<semantics>` 和 `<annotation>` 包装器
|
||||
- ❌ 使用 `display="inline"` 而不是 `display="block"`
|
||||
- ❌ 缺少 `xmlns` 命名空间
|
||||
- ❌ 使用 HTML 实体编码而不是实际字符
|
||||
### 1. **MathML 格式问题**(已全部修复 ✅)
|
||||
- ~~包含 `<semantics>` 和 `<annotation>` 包装器~~ ✅ 已移除
|
||||
- ~~使用 `display="inline"` 而不是 `display="block"`~~ ✅ 已修复
|
||||
- ~~缺少 `xmlns` 命名空间~~ ✅ 自动添加
|
||||
- ~~使用 HTML 实体编码而不是实际字符~~ ✅ 已解码
|
||||
- ~~包含冗余属性~~ ✅ 已清理
|
||||
|
||||
### 2. **Word 粘贴方法不正确**
|
||||
- ❌ 直接粘贴到正文
|
||||
- ❌ 使用"选择性粘贴"
|
||||
- ❌ 粘贴位置不对
|
||||
|
||||
## 已修复的问题
|
||||
|
||||
我们的代码现在会自动:
|
||||
✅ 移除 `<semantics>` 和 `<annotation>` 包装器
|
||||
✅ 设置 `display="block"`
|
||||
✅ 添加正确的 `xmlns` 命名空间
|
||||
✅ 解码 Unicode 实体为实际字符
|
||||
|
||||
## Word 中正确的粘贴方法
|
||||
|
||||
### 方法 1:使用 MathType(推荐)✨
|
||||
|
||||
Reference in New Issue
Block a user