You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

导出至MS Word时Pandoc丢失自定义样式的问题咨询

Asciidoc转Word时自定义样式丢失问题

我的Asciidoc文档

= Test 

== Introduction
lorem ipsum 

[.custom]
This text should use the CustomStyle from Word.

转换流程(基于标准reference.docx)

我通过以下两步将文档经DocBook中转转换为MS Word:

docker run --rm  -v $(pwd):/documents/ asciidoctor/docker-asciidoctor:1.67 asciidoctor -b docbook  "/documents/test.adoc"
docker run --rm -v $(pwd):/data/ pandoc/core:latest /data/test.xml -s -o /data/test.docx -r docbook -t docx  --reference-doc="/data/reference.docx" 

中间DocBook文件内容

转换后的DocBook文件仍保留了自定义样式:

<?xml version="1.0" encoding="UTF-8"?>
<?asciidoc-toc?>
<?asciidoc-numbered?>
<article xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en">
<info>
<title>Test</title>
<date>2025-01-06</date>
</info>
<section xml:id="_introduction">
<title>Introduction</title>
<simpara>lorem ipsum</simpara>
<simpara role="custom">This text should use the CustomStyle from Word.</simpara>
</section>
</article>

问题现象

但最终生成的MS Word文件中,自定义样式丢失了。解压Word文件查看其XML内容,发现这段文本被应用了默认的BodyText样式:

<w:p><w:pPr><w:pStyle w:val="BodyText" /></w:pPr><w:r><w:t xml:space="preserve">This text should use the CustomStyle from Word.</w:t></w:r></w:p>

请问这是我遗漏了必要的操作步骤,还是属于Pandoc的bug?

内容的提问来源于stack exchange,提问作者DerNils

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.15 03:39:51