2

There's a lot of libraries to render markdown file. But I cannot found any library to produce a *.md file from Java code. I'm looking for some library like:

FileOutputStream outStream = new FileOutputStream("readme.md");
MarkdownDocument doc = new MarkdownDocument(outStream);
doc.appendHeader1("Welcome", HeaderStyle.UNDERLINE);
doc.appendParagraph("A paragraph...");
doc.flush();

And the above code would produce the following content:

Welcome
=======

A paragraph...

Update

Actually, either markdown or asciidoc library is OK. I'm building a testing tool, which will need to generate report. To support both Word, PDF and HTML formats, I want to produce plain text report first, then use Pandoc to convert it into the desired format.

Hope that the update make my intension more clear for a better recomnendation.

  • I would expect that pretty much any markdown parser would also include "writer" methods, so MarkdownPapers would be a good place to look. – CPerkins Jul 29 '16 at 17:10
  • Thanks for your suggestion. I have looked in pegdown, commonmark-java, txtmark and MarkdownPapers. None of them matches my requirement. – Tai Le Jul 29 '16 at 18:03
  • They don't have write methods? I'm surprised. How long can you wait for a jar? – CPerkins Aug 1 '16 at 12:57
  • Next Friday is my deadline for the report generating feature. So, I've planned to implement the library myself. Just some basic features, enough for the case. But if you also want to do that, I'm happy to give my contribution. For the first question, the rendering libraries only support for custom renderer from the AST after parse the input markdown. – Tai Le Aug 1 '16 at 13:27
  • Next Friday is too close for me to be certain I can help you. Good luck with your project. – CPerkins Aug 1 '16 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.