Implement the output stage — emit a MarkdownDocument as either Markdown or HTML.
Scope
MarkdownFormatter with two output modes:
toMarkdown(doc: MarkdownDocument): String — via commonmark-java MarkdownRenderer; front matter is prepended verbatim before the rendered bodytoHtml(doc: MarkdownDocument): String — via commonmark-java HtmlRenderer; front matter is omitted from HTML outputtoFile(doc: MarkdownDocument, file: File, mode: OutputMode) convenience
Notes
- Uses
org.commonmark.renderer.markdown.MarkdownRenderer and org.commonmark.renderer.html.HtmlRenderer - Both renderers must be configured with the same extensions as the parser (
TablesExtension, YamlFrontMatterExtension) - Front matter in Markdown output: prepend the raw string + newline before the rendered AST body
Acceptance criteria
- Markdown output round-trips a document with front matter correctly
- HTML output does not include raw front matter YAML
- Both modes handle documents without front matter
Implement the output stage — emit a
MarkdownDocumentas either Markdown or HTML.Scope
MarkdownFormatterwith two output modes:toMarkdown(doc: MarkdownDocument): String— via commonmark-javaMarkdownRenderer; front matter is prepended verbatim before the rendered bodytoHtml(doc: MarkdownDocument): String— via commonmark-javaHtmlRenderer; front matter is omitted from HTML outputtoFile(doc: MarkdownDocument, file: File, mode: OutputMode)convenienceNotes
org.commonmark.renderer.markdown.MarkdownRendererandorg.commonmark.renderer.html.HtmlRendererTablesExtension,YamlFrontMatterExtension)Acceptance criteria