Java
Java
Markdown to HTML - Full Document, Raw
See more Markdown Examples
Demonstrates how to convert a complete Markdown document to HTML using theraw theme. With the raw theme, only the HTML elements are generated, excluding:
- Document Type Declaration (e.g. <!DOCTYPE html>)
- Root Element (e.g., <html> )
- Head Section
- Enclosing <body> and </body> elements
- Closing </html> element
Chilkat Java Downloads
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
boolean success = false;
CkJsonObject options = new CkJsonObject();
options.UpdateString("theme","raw");
CkStringBuilder sbMarkdown = new CkStringBuilder();
CkStringBuilder sbHtml = new CkStringBuilder();
success = sbMarkdown.LoadFile("qa_data/markdown/test1.md","utf-8");
if (success == false) {
System.out.println(sbMarkdown.lastErrorText());
return;
}
sbMarkdown.MarkdownToHtml(options,sbHtml);
sbHtml.ToCRLF();
System.out.println(sbHtml.getAsString());
// Sample markdown input:
// (See sample HTML output below.)
//
// Sample HTML output:
//
}
}