feat(transit): 改进正文段落到Word文档的转换功能

支持自定义标题级别偏移量和正文样式,增强样式应用的灵活性。
- 新增 level_offset 参数用于调整标题级别
- 新增 body_style 参数用于设置正文段落样式
- 改进样式应用逻辑,支持多种样式的降级机制
- 更新配置文件以支持新的样式配置选项
- 修改解析器使致谢、参考文献和附录部分只提取正文内容
This commit is contained in:
zzy
2026-05-08 21:44:09 +08:00
parent ae70d05672
commit c29a3e6af0
4 changed files with 75 additions and 28 deletions

View File

@@ -113,19 +113,19 @@ def parse_markdown(
else:
data["body_md"] = ""
# ── 致谢 ──
# ── 致谢(仅正文,不含标题行) ──
ack = _find_section(content, ["致谢"])
if ack:
data["acknowledgement"] = content[ack[0] : ack[1]].strip()
data["acknowledgement"] = _get_section_body(content, ack)
# ── 参考文献 ──
# ── 参考文献(仅正文,不含标题行) ──
ref = _find_section(content, ["参考文献"])
if ref:
data["reference"] = content[ref[0] : ref[1]].strip()
data["reference"] = _get_section_body(content, ref)
# ── 附录 ──
# ── 附录(仅正文,不含标题行) ──
app = _find_section(content, ["附录"])
if app:
data["appendix"] = content[app[0] : app[1]].strip()
data["appendix"] = _get_section_body(content, app)
return data