HTML to Markdown with Java -


is there easy way transform html markdown java?

i using java markdownj library transform markdown html.

import com.petebevin.markdown.markdownprocessor; ... public static string gethtml(string markdown) {     markdownprocessor markdown_processor = new markdownprocessor();     return markdown_processor.markdown(markdown); }  public static string getmarkdown(string html) { /* todo ask stackoverflow */ } 

use xslt.

if need using xslt , java here's code snippet:

public static void main(string[] args) throws exception {          file xsltfile = new file("mardownxslt.xslt");          source xmlsource = new streamsource(new stringreader(thehtml));         source xsltsource = new streamsource(xsltfile);          transformerfactory transfact =                 transformerfactory.newinstance();         transformer trans = transfact.newtransformer(xsltsource);          stringwriter result = new stringwriter();         trans.transform(xmlsource, new streamresult(result));     } 

Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -