Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to convert markdown link to html using Pandoc

How to convert markdown link to html using Pandoc


Pandoc cannot convert a link's URL as expected.



<a href="./">Document</a>

Expected HTML:

<a href="./document.html">Document</a>


According to ota-meshi's procedures, it is quite easy.
The following is what I did in less than 15 minutes.

  1. Down and install Pandoc

  2. Down and install Python because Panflute requies Python to run.

  3. According to Panflute's guide I executed the following command.

    • no proxy

        > pip install panflute
    • behind proxy

        > pip install panflute --proxy http://<user id>:<password>@<proxy address>
  4. I also install pypandoc so that I can avoid using external commands.

    • no proxy

        > pip install pypandoc
    • behind proxy

        > pip install pypandoc --proxy http://<user id>:<password>@<proxy address>
  5. Copy and paste the following Python files to a temp folder.

  6. Move to the directory that contains markdown file(s).

  7. Execute the following command.
    By the way, this command automatically convert to index.html.
      - To use Japanese CSS (/ja/github.css)  

         > python <path to the temp folder>/ --locale ja
    • To use English CSS (/en/github.css)

        > python <path to the temp folder>/ --locale en
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment