Package com.oorian.markdown
Class MarkdownParser
java.lang.Object
com.oorian.markdown.MarkdownParser
Parses Markdown text and produces native Oorian HTML elements.
This parser converts Markdown-formatted text into Oorian's server-side HTML element tree, enabling pure Java Markdown rendering without any JavaScript dependency.
Supported block elements:
- ATX headings (
#through######) - Paragraphs (blank-line separated)
- Fenced code blocks (
```with optional language) - Indented code blocks (4 spaces)
- Blockquotes (
>prefix, nested via recursion) - Unordered lists (
-,*,+markers, nested) - Ordered lists (
1.markers, nested) - Horizontal rules (
---,***,___) - GFM tables (
|delimiters with alignment)
Supported inline elements:
- Bold (
**text**,__text__) - Italic (
*text*,_text_) - Bold+Italic (
***text***) - Strikethrough (
~~text~~) - Inline code (
`code`) - Links
[text](url "title") - Images
 - Line breaks (two trailing spaces)
- Escaped characters (
\*produces literal*)
Usage:
// Parse Markdown into a Div container
Div content = MarkdownParser.parse("# Hello\n\nThis is **bold**.");
container.addElement(content);
// Parse into a list of elements
List<Element> elements = MarkdownParser.parseToElements(markdown);
// Parse a single line of inline Markdown
Span inline = MarkdownParser.parseInline("This is **bold** text");
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic DivParses Markdown text and returns aDivcontaining the resulting HTML elements.static SpanparseInline(String markdown) Parses a single line of inline Markdown and returns aSpancontaining the result.parseToElements(String markdown) Parses Markdown text and returns a list of HTML elements.
-
Method Details
-
parse
Parses Markdown text and returns aDivcontaining the resulting HTML elements.- Parameters:
markdown- The Markdown text to parse.- Returns:
- A Div element containing the parsed HTML elements.
-
parseToElements
Parses Markdown text and returns a list of HTML elements.- Parameters:
markdown- The Markdown text to parse.- Returns:
- A list of parsed HTML elements.
-
parseInline
Parses a single line of inline Markdown and returns aSpancontaining the result.- Parameters:
markdown- The inline Markdown text to parse.- Returns:
- A Span element containing the parsed inline elements.
-