markdown-notes icon indicating copy to clipboard operation
markdown-notes copied to clipboard

Export to PDF

Open AuHau opened this issue 7 years ago • 2 comments

Another feature which I think would be highly appreciated is exporting the Markdown file into PDF files. Myself I was writing some exam essays on MD Notes and to submit it, I had to download the MD file and convert it with some online tool, like for example http://www.markdowntopdf.com/.

This would mean to implement two things on backend:

  1. Markdown-to-HTML conversion - for example with Python-Markdown (it will be necessary to compare output of marked.js and this package, to see if there are any major differences)
  2. PDF rendering of HTML code - I found two Python solutions - Reportlab and WeasyPrint

AuHau avatar Oct 21 '16 07:10 AuHau

This is by far the most requested feature since the website went online. I have not looked at it, but my biggest concern is always rendering differences between whichever PDF converter we use and our Markdown parser + browser stylesheets.

I think the best approach would be one that does not use the backend at all, or at least that can render the code generated in the browser.

Another major issue is the LaTeX support, something that's definitely not part of the spec.

nicbou avatar Oct 21 '16 08:10 nicbou

Yeah, I thought so... Well I understand your concern, but if I would speak on high level, I think the differences should not matter that much. What I mean by that is that Markdown is meant for simple formatting (eq. headlines, lists, urls etc.), not for some fancy rich-formatting. So if we would be able to provide OK-look (which should not be hard) and bring it as close as possible to look which we have in the browser editor, than I would call that success!

Well I am not sure if going without backend would be possible with this (you could use some other online services for this, but yeah I think that output from the service would be really different and generally I think that depend on other external service is bad idea). Regarding to have the same code generated as in browser, well we could create micro-service based on Node.js with marked.js which would take the Markdown and return the rendered HTML which would be identical to browser code...

But yeah, the LaTeX support is definitely the biggest issue here. But MathJax should be able to produce images (SVG) right? So technically we should be able to produce images on server, which would be embed into the PDF... With just a bit googleing I found this MathJax-node, so if we would go with the solution of the Node service, we should be able to achieve almost identical output as in browser...

AuHau avatar Oct 21 '16 08:10 AuHau