Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docx --reference-doc result doesn't have "Source Code" style #10646

Open
jweaver-ca opened this issue Feb 27, 2025 · 1 comment
Open

docx --reference-doc result doesn't have "Source Code" style #10646

jweaver-ca opened this issue Feb 27, 2025 · 1 comment
Labels

Comments

@jweaver-ca
Copy link

jweaver-ca commented Feb 27, 2025

Command used (pandoc v. 3.6.3):

pandoc -o custom-reference.docx --print-default-data-file reference.docx

The file custom-reference.docx doesn't have a "Source Code" style in it for me to modify.

When I used pandoc to convert markdown to docx, a "Source Code" style is added and is applied to code blocks that should be printed as code. I would like to modify this style in the reference doc but I can't because it's not there.

I have tried adding the "Source Code" style manually to the reference doc, but after conversion I find (weirdly) that pandoc is now using "Verbatim Char" style and ignores my added "Source Code" style.

@jweaver-ca jweaver-ca added the bug label Feb 27, 2025
@jgm
Copy link
Owner

jgm commented Feb 27, 2025

The reason it isn't present in the default template is that we create it dynamically depending on the highlighting style selected. But you can add your own if you want. Here is a minimal default definition:

<w:style w:type="paragraph" w:customStyle="1" w:styleId="SourceCode">
<w:name w:val="Source Code" />
<w:basedOn w:val="Normal" />
<w:link w:val="VerbatimChar" />
<w:pPr>
<w:wordWrap w:val="off" />
</w:pPr>
</w:style>

Note that it links to the Verbatim Char character style; this will be used to style the characters, so e.g. if you want a different font you need to modify that instead.

Are your code blocks marked with a syntax? (If so, highlighting will be used.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants