-
Notifications
You must be signed in to change notification settings - Fork 298
Expand file tree
/
Copy pathHtmlToMarkdownSample.java
More file actions
30 lines (26 loc) · 1.49 KB
/
HtmlToMarkdownSample.java
File metadata and controls
30 lines (26 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.vladsch.flexmark.java.samples;
import com.vladsch.flexmark.html2md.converter.FlexmarkHtmlConverter;
public class HtmlToMarkdownSample {
public static void main(String[] args) {
String html = "<ul>\n" +
" <li>\n" +
" <p>Add: live templates starting with <code>.</code></p>\n" +
" <table>\n" +
" <thead>\n" +
" <tr><th> Element </th><th> Abbreviation </th><th> Expansion </th></tr>\n" +
" </thead>\n" +
" <tbody>\n" +
" <tr><td> Abbreviation </td><td> <code>.abbreviation</code> </td><td> <code>*[]:</code> </td></tr>\n" +
" <tr><td> Code fence </td><td> <code>.codefence</code> </td><td> ``` ... ``` </td></tr>\n" +
" <tr><td> Explicit link </td><td> <code>.link</code> </td><td> <code>[]()</code> </td></tr>\n" +
" </tbody>\n" +
" </table>\n" +
" </li>\n" +
"</ul>";
String markdown = FlexmarkHtmlConverter.builder().build().convert(html);
System.out.println("HTML:");
System.out.println(html);
System.out.println("\nMarkdown:");
System.out.println(markdown);
}
}