-
Hello everyone, I've written a book in Word 2019 using a template I created myself with some custom styles based on existing ones. For example, I used the modified Heading 2 style and called it Internal Heading, and so on with all the logical styles, hoping to later obtain the h1, h2, h3, separator, etc., in the conversion. In the case of Internal Heading, it should become h2, for example. I've tried Pandoc using Lua styles and adding CSS and fonts in Woff, but I can't get it to differentiate the styles. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 11 replies
-
You can use the I'm not sure what you mean by
|
Beta Was this translation helpful? Give feedback.
-
Thank you for your reply. Let me clarify what I’m doing, as it might help better explain where the issue lies. I'm trying to convert a
The styles are applied correctly in Word, and I verified that they are preserved in the DOCX structure (including when I unzip the My current workflow:
pandoc "document.docx" -o output.epub --extract-media=media --lua-filter=styles.lua
I read that the Do I need to first convert the Note: I’m attaching the ZIP with my Lua filter, stylesheet, and Word style template ( Any advice would be appreciated! |
Beta Was this translation helpful? Give feedback.
-
Thank you so much for your help! Your suggestion to inspect the AST with I also followed your command structure and slightly extended it for my use case: pandoc -f docx+styles entrada.docx -L filter.lua -c fuentes.css --metadata title="Las puertas del abismo" --split-level=2 -o salida.epub
So far, everything works as intended except one last issue: 🔸 I'm trying to insert pandoc.RawBlock("html", '<hr class="salto-h2" />') ...and styled in hr.salto-h2 {
page-break-before: always;
border: none;
height: 2em;
} However, after inspecting the EPUB's output files ( 📎 I've attached my current Any ideas on why the raw |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for your comment! ✅ I’ve now solved the page break issue by using the option 📘 The updated command I'm using is: pandoc -f docx+styles entrada.docx -L filter.lua -c fuentes.css --metadata title="Las puertas del abismo" --split-level=4 --toc --toc-depth=4 -o salida.epub 🔍 However, my current issue is: The custom styles defined in the DOCX file — such as
This is confirmed by the presence of structures like:
However, when converting the same
...these custom styles are NOT mapped into HTML classes in the resulting EPUB, unless they are handled explicitly via Lua filters. ✅ Current Situation The Lua filter does receive the correct ✅ What I Need I want to ensure the final EPUB has elements like:
🔍 In particular, the
This dual usage is by design, and I’m using it deliberately to convey typographic nuance in the final EPUB. Is there a recommended way to support this dual output cleanly — or should this always be handled manually via a Lua filter? I’m already using Lua if necessary, but I'd like to confirm that this kind of style-dependent transformation is not achievable with CSS alone in the Pandoc DOCX → EPUB3 pipeline. Examples: |
Beta Was this translation helpful? Give feedback.
-
Hi @rnwst and everyone, I wanted to provide a detailed update on my testing following your guidance, and explain why the issue with Word paragraph styles persists in the EPUB output despite our best efforts. 🧪 What I tried
🔍 What actually happens
🚧 Why this matters
✔️ ConclusionFollowing your advice, I modified the ❓ Questions for the developers:
Thanks again for your guidance—I’ve been down this rabbit hole for days and would appreciate any insights into ways to make the custom paragraph classes survive into the final EPUB. 🙏
|
Beta Was this translation helpful? Give feedback.
The filter you have listed above works fine for me and replaces the custom attributes with classes when running
pandoc -f docx+styles .\entrada.docx -L .\filter2.lua -o salida.epub
using the DOCX you have attached and the filter you have listed above:In the zip archive you have attached, the filter doesn't work because it uses
data-custom-style
instead ofcustom-style
, as I have pointed out in my comment above.I don't think I can do anything else to …