Class MarkdownParser

All Implemented Interfaces:
MarkdownMetaProvider, RecordReadable
Direct Known Subclasses:
MarkdownDocParser

Parses Markdown fragment-mode output (tables and lists) back to POJOs.
Media types

Handles Content-Type types: text/markdown, text/x-markdown

Description

Parses Markdown tables and bulleted lists produced by MarkdownSerializer back into Java objects. The following mappings apply:

  • 2-column key/value tables are parsed as beans or Maps.
  • Multi-column tables are parsed as Lists of beans or Maps.
  • Bulleted lists are parsed as Lists.
  • Table cells containing backtick-wrapped JSON5 values are parsed via Json5Parser.
Example:

// Parse a Markdown table to a bean String md = "| Property | Value |\n|---|---|\n| name | Alice |\n| age | 30 |"; Person p = MarkdownParser.DEFAULT.read(md, Person.class);

// Round-trip example String md = MarkdownSerializer.DEFAULT.write(myBean); MyBean parsed = MarkdownParser.DEFAULT.read(md, MyBean.class);

Limitations:
  • Multi-line string values cannot round-trip; newlines in cells are literal <br> text.
  • The configured null value string (default: *null*) is interpreted as null, not as the literal string.
  • Without a target type, table cell values are auto-detected as Integer, Long, Double, Boolean, or String.
  • Type ambiguity: without a target type, tables return Map<String,Object> (key/value) or List<Map> (multi-column).
  • This class is thread safe and reusable.
See Also: