0

Pandoc is a great tool to transform files from one format to another. Among all the diverse functions it provides, one interesting function is to generate self-contained portable HTML file. This function is very useful when you want to share your HTML files with your colleagues. However, when the link contains full path file. For example, the html file original.html contains the following HTML items:

    <a href="file:///media/distribution/file_num.png" target="_blank" />
<img src="file:///media/distribution/file_num.png" /></a>

When I use pandoc original.html --self-contained -o transformed.html to generate a portable HTML file, the following error message is given:

pandoc: Could not fetch file:///media/distribution/file_num.png

InvalidUrlException"file:///media/distribution/file_num.png" "Invalid scheme". 

Any ideas? Thanks.

EDIT: I also tried to use pypandoc,

output=pypandoc.convert_file('data.html','html',outputfile="ddd.html",extra_args=['--self-contained'])

but the same error happens:

'Pandoc died with exitcode "%s" during conversion: %s' % (p.returncode, stderr)
RuntimeError: Pandoc died with exitcode "61" during conversion:
feelfree
  • 11,175
  • 20
  • 96
  • 167
  • try the newest pandoc version from https://github.com/jgm/pandoc/releases – mb21 Nov 23 '18 at 08:08
  • @mb21 Thanks, and I have tried but the same problem still exists. – feelfree Nov 23 '18 at 09:09
  • cannot reproduce with pandoc 2.4... btw. pandoc is probably slightly overkill if you just want to change the header/footer of an HTML file... – mb21 Nov 23 '18 at 09:21

0 Answers0