0
votes

I have multiple markdown files to become a Word doc:

pandoc -f markdown --toc -o out.docx \
  file1.md \
  dirA\file2.md \
  dirB\file3.md

The source files have links that reference each other (intended for HTML output originally), but I can't for the life of me get those links to resolve in the output Word doc. For example, in file1.md there might be [a link](dirA/file2.html). I've tried using full paths to the file (which is what worked to get images that were originally relatively-linked to resolve), changing the extension to .md. Doesn't work. Perhaps the links need to refer to headings rather than files? If that's the case, what rules does pandoc use for generating heading anchors and do the source file names come into play at all?

1

1 Answers

0
votes

If you specify multiple input files, they are actually concatenated by the shell and then passed to pandoc. So no, the input file names don't come into play (which is counter-intuitive for HTML, but makes a lot of sense for docx output).

Referring to headers might work in docx output as well, but I'm not sure (is there even a concept of internal link in Word?):

# foo

[go](#foo)

Also see http://pandoc.org/MANUAL.html#header-identifiers