markdown
A markdown parser library for Go. Used to power etherealmachine.github.io.
Major features
Inline HTML
Markdown was designed to let you easily fallback to raw HTML. This is great, but it limits you when you want to mix HTML and Markdown. For example, if you try wrapping some Markdown in a div
for styling:
<div style="float: left;">
# Some header
More markdown, maybe with *emphasis*
</div>
The Markdown passes right through without being parsed, like so:
<div style="float: left;">
# Some header
More markdown, maybe with *emphasis*
</div>
Ethereal Markdown parses the text inside the div
, letting you mix Markdown inside your usual HTML:
<div style="float: left;">
<h1>Some header</h1>
<p>More markdown, maybe with <em>emphasis</em></p>
</div>
Directives
Sometimes you need a little more control over the HTML generated by the parser. For example, Github-Flavored Markdown (GFM) can produce awesome tables:
Col1 | Col2
---- | ----
Foo | Bar
Turns into:
<table>
<tr><th>Col1></th><th>Col2</th></tr>
<tr><td>Foo></td><td>Bar</td></tr>
</table>
But if you're using Bootstrap, or some other CSS library, you need to add class="table"
to your tables, and you're SOL.
In Ethereal Markdown, you can use the table
directive:
<!--table class="table"-->
Col1 | Col2
---- | ----
Foo | Bar
To get :
<table class="table">
<tr><th>Col1></th><th>Col2</th></tr>
<tr><td>Foo></td><td>Bar</td></tr>
</table>
Differences from Github-Flavored Markdown
- No URL autolinking
- No strikethrough
- Syntax highlighting: The optional language identifier is added as a class on the block's
pre
tag
- Tables: Cannot use pipes on the table end
Differences from plain Markdown
- Headers only accept the Atx
#
format (e.g. # Header
- No horizontal rules
- No automatic links