Reputation: 31
Pandoc convert/export md to docx produces square brackets around headings
use pandoc to convert to docx. Converted ok but I'm getting faint square brackets around headings. I cannot select them or get rid of them.
pandoc 3.2.1 Features: +server +lua Scripting engine: Lua 5.4
Windows 11 Pro - version 10.0.26120 Build 26120 - 64 GB Ram Processor AMD Ryzen 7 3700X 8-Core Processor, 3593 MHz
Upgrade pandoc to latest edition (2024-07-09).
Run pandoc md to docx from terminal instead of Obsidian-plugin.
Convert a doc with only headers in it:
# Header 1
## Header 2
### Header 3
pandoc minimal.md -o minimal.docx
Same problem with faint braces (I have a screenshot but can't post it, I'm new here.).
Convert to odt
pandoc minimal.md -o minimal.odt
Same problem with faint braces. Brackets for Header 2 are in italic in .odt, not in .docx (I have screenshot but can't post it. I'm new here.).
Convert to html to docx
pandoc minimal.md -o minimal.html
looks fine. Then:
pandoc minimal.html -o minimal.docx
Faint brackets are back again.
It is not an issue 'Wiki-links not removed when exporting from markdown'. 'Pandoc md to docx' converts links, images (imgur url) and all headers just fine. Except for the faint square brackets. They appear where a header exists rather than a wikilink. IE where there is one or more "# " in the md.
(1) A way to use pandoc without getting the faint brackets in ms word docx. I love Markdown and Obsidian for writing. I need to be able to export to ms word.
(2) Plan B. If (1) is not possible a workaround/way to get rid of the faint brackets. I can't select, find&replace or delete them and when I select all text (ctrl-a) and copy&paste the text to another doc, they are still there.
I've been looking around the web and over here. I found no answers, just one person having the same problem. https://forum.obsidian.md/t/pandoc-export-to-docx-produces-square-brackets-around-headings/67824
Anybody ideas? So much appreciated.
Upvotes: 2
Views: 275
Reputation: 31
Thank you so much! This works for me.
To whom it may concern, on Windows it's:
File > Options > Advanced > scroll down to 'Show document content' and uncheck 'Show bookmarks'.
Upvotes: 1
Reputation: 11
I also encountered the faint brackets when exporting to docx and was able to reproduce your example. Axel was right that it had something to do with "how things are displayed".
I could hide the brackets by going into Word's settings:
On Mac, View > Show in Document > Uncheck "Bookmarks".
There should be an equivalent setting on Windows.
UPDATE: In case you use a workflow which includes the Zotero add-in for Word: If you use the advanced option to "store citation as bookmarks", then Zotero will (annoyingly) re-enable the display of bookmarks in Word.
Upvotes: 1
Reputation: 11324
I can't confirm your findings.
My pandoc
pandoc -v
pandoc 3.2.1
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: C:\Users\xxx\AppData\Roaming\pandoc
Copyright (C) 2006-2024 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 urpose.
My markdown
# Header 1
## Header 2
### Header 3
Result of
pandoc minimal.md -o minimal.docx
Result of
pandoc minimal.md -o minimal.odt
The grayish squared brackets vanish in the print output.
Perhaps, it is a matter of Word/LibreWriter templates, how things are displayed in your environment.
Upvotes: 0