Markdown (GFM) mapping
How markup-markdown-writer maps model elements to Markdown (GitHub-flavored) source text.
Document structure
-
A non-blank document title is written as
# Titleon its own line. -
Top-level blocks are separated by one blank line (also between the title and the first block).
-
Inside a section, one blank line precedes every child block.
Block mapping
| Model element | Produced Markdown | Notes |
|---|---|---|
|
<a id="id"></a> ## Title |
|
|
the text followed by a newline |
no wrapping or escaping is applied |
|
```kotlin code ``` |
the language is appended directly to the opening fence; a blank language yields a bare |
|
<a id="id"></a> [](url) |
base form |
|
1. first
1. nested
- bullet
|
|
|
<a id="id"></a> **Title** | a | b | |
anchor and bold-title lines appear only when non-blank, followed by one blank line when either is present, then the table mapping below. |
Table mapping
-
Each row is written as
| cell | cell |— cells padded with one space on each side. -
The header row is followed by a delimiter row:
| --- |repeated per column. -
Pipe characters inside cell content are escaped as
\|. -
GFM tables require a header row; a headerless
Tablegets a synthesized header row of empty cells. The column count is the maximum cell count across header and rows.
| col 1 | col 2 |
| --- | --- |
| Hello | World |
Deviations from the AsciiDoc output
Where GFM lacks a native construct, the writer maps rather than drops silently:
| Model feature | GFM mapping |
|---|---|
block ids |
|
table titles |
a bold |
headerless tables |
synthesized header row of empty cells (GFM tables require a header row) |
image width/height |
dropped (no native syntax) |
See also
-
Writer API contract — the four output forms
-
AsciiDoc mapping — the same model in AsciiDoc