https://gist.github.com/te-lang-wakker/b401bcf7f05658c624fab...
Only problem was that hyperlinks are converted into footnotes, but I'd be surprised if you can't hack your way around that.
(I know that pandoc is incredibly flexible.)
> From a technical point of view, WeasyPrint is a visual rendering engine for HTML and CSS that can export to PDF. It aims to support web standards for printing. WeasyPrint is free software made available under a BSD license.
Hmm, I wonder if you could use servo for a similar purpose.
Actually, the task was more difficult, because the input should also be used to produce a website -- and mkdocs was used for this.
I have a list of problems that came up and required not-insignificant amount of work to be solved. Many of them were about the handling of images.
The recently added support for PDF/A is also quite exciting, as I've never found a satisfactory solution to this with latex. Now I just wish journals would support markdown submissions...