jgm / pandoc

Universal markup converter
https://pandoc.org
Other
33.95k stars 3.35k forks source link

YAML metadatas are converted uncorrectly with a custom reference doc #10117

Open Astro-Aionia opened 2 weeks ago

Astro-Aionia commented 2 weeks ago

Explain the problem.

When metadatas are included in a markdown file like below:

---
title: This is a Tilte
author: Alice
date: 2024/07/12
---

Text ...

It can be converted to DOCX file correctly with:

  1. The simplest command: pandoc input.md -o output.docx
  2. A command with unchanged default reference template: pandoc input.md -o output.docx --reference-docx=custom-reference.docx. The custom.docx file was generated by pandoc -o custom-reference.docx --print-default-data-file reference.docx and nothing was changed.

In above conversions, the metedata title will be associate with "Title" style in word. But if I change any styles in custom.docx file, metedata title will be associate with "Normal" style.

This bug only occured with yaml metadatas. Everything in the following text is correct.

Pandoc version?

Pandoc 3.3. In 3.1.11, everything is correct.

jgm commented 2 weeks ago

I couldn't reproduce the issue, following the steps above. I get the Title style even after modifying the Title style in the custom reference docx, saving, and using it to create a new docx.

jgm commented 2 weeks ago

Are you using Word to modify the docx, or something else? (e.g. LibreOffice)