Skip to content

Docx writer does not correctly render code fences (no syntax highlighting) #11156

@fbristow

Description

@fbristow

Explain the problem.

The command that I ran is:

pandoc code.md -o code.docx

The file code.md contains:

# Code

Some code:

```java
public static void main(String[] args)
{
    System.out.println("Hello, world!");
}
```

The code.docx produced by Pandoc does not syntax highlight or render the code as monospace.

The output is as expected when I do the same thing with HTML as an output:

pandoc code.md -o code.html --standalone

Produces an HTML file with syntax highlighting enabled.

Pandoc version?

I am currently using

pandoc 3.8
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: /home/fbristow/.local/share/pandoc
Copyright (C) 2006-2025 John MacFarlane. Web:  https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.

The previous version of Pandoc (3.7.0.2) produced the output I was expecting.

I suspect that this is related to the change introducing A new command line option --syntax-highlighting.

Please let me know if I can provide anything else. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions