This is a markdown engine developed for my personal blog. The syntax is dialect of gfm, but not subset or superset of it.
If you're reading this document on github, some elements are not rendered properly. Please visit my blog to see the correct version.
This document is mainly focused on its markdown syntax. If you want to use this engine for your blog, read the crate's document.
Don't try edge cases! There must be tons of glitches.
Not at all.
 
, <
, and ...).
<
, >
, or &
, just type as it is.<details>
tag is not supported, but it'll be added soon.<!-- -->
does not work here.
Table rows and delimiter rows resemble that of gfm's table, but a bit more strict. Each cell must be enclosed by two pipes (|
), including the first and the last cell. You can also set its alignment using colons.
|Left aligned Column |Centered Column |Right aligned Column | |:-------------------|:--------------:|--------------------:| | Left | Center | Right | | Left | Center | Right | | Left | Center | Right | | Left | Center | Right | | Left | Center | Right |
It has limited range of syntax.
line_num(n)
option. The number n
designates the first index.
rust, line_num(0)
fn main() {
println!("Hello World!");
}
fn add_one(n: i32) -> bool {
n + 1
}
```rust, line_num(0) fn main() { println!("Hello World!"); }
fn add_one(n: i32) -> bool { n + 1 } ```
*
for emphasis, not _
.
*
is not a valid bullet for unordered lists, only -
is.1.
, i.
, I.
, a.
, and A.
are the only valid bullets for ordered lists.
Some of these extensions are from pandoc's markdown spec. The others are my custom extensions.
~_Underlines_~
is rendered to ~Underlines~. Underlines may not contain any newline. The first and the last character may not be space.
H~2~O
is rendered to H~2~O. Subscripts may not contain any space or newline.
E=mc^2^
is rendered to E=mc^2^. Superscripts may not contain any space or newline.
HMD has wide variety of tags. It uses double square brackets instead of HTML's angle brackets. All the spaces inside the brackets are ignored.
Some tags have to be properly closed, or it would ruin the rendered html file! The engine does not check whether a tag is closed, so you have to take care of that. Also, be careful not to mix extra tags with other html tags. Most extra tags generate <div>
or <span>
tags when rendered. Those rendered tags can be mixed with auto-generated <p>
tags. To prevent that you should either
If you do something like below,
``` [[box]] A paragraph
Another paragraph [[/box]] ```
the result would be like below.
```html
Another paragraph
```
It would look fine on most browsers, but not desirable though.
It's rendered to <div>
tag.
[[box]][[/box]]
draws a box. You can put (almost) everything inside a box. You can even nest boxes!
[[box]]
[[center]][[big]]A box.[[/big]][[/center]]
|A table inside a box.| |--------------------| |[[box]] A box inside a table. [[/box]]| |But you cannot have a table inside a box inside a table.| |Because you cannot put a table in another table.|
[[/box]]
It's rendered to <span>
tag.
| HMD code | Rendered result |
|------------------------------------------|-------------------------------------------|
| [[big]]Big font[[/big]]
| [[big]]Big font[[/big]] |
| [[medium]]Medium font[[/medium]]
| [[medium]]Medium font[[/medium]] |
| [[small]]Small font[[/small]]
| [[small]]Small font[[/small]] |
| [[Big]]It's case insensitive![[/Big]]
| [[Big]]It's case insensitive![[/Big]] |
It's rendered to <span>
tag.
| HMD code | Rendered result |
|------------------------------------------|-----------------------------------------|
| [[red]]rgb(192, 32, 32)[[/red]]
| [[red]]rgb(192, 32, 32)[[/red]] |
| [[orange]]rgb(255, 165, 0)[[/orange]]
| [[orange]]rgb(255, 165, 0)[[/orange]] |
| [[aqua]]rgb(64, 192, 192)[[/aqua]]
| [[aqua]]rgb(64, 192, 192)[[/aqua]] |
| [[green]]rgb(32, 192, 32)[[/green]]
| [[green]]rgb(32, 192, 32)[[/green]] |
| [[blue]]rgb(32, 128, 255)[[/blue]]
| [[blue]]rgb(32, 128, 255)[[/blue]] |
| [[lime]]rgb(0, 255, 0)[[/lime]]
| [[lime]]rgb(0, 255, 0)[[/lime]] |
| [[yellow]]rgb(192, 192, 32)[[/yellow]]
| [[yellow]]rgb(192, 192, 32)[[/yellow]] |
| [[violet]]rgb(187, 134, 252)[[/violet]]
| [[violet]]rgb(187, 134, 252)[[/violet]] |
| [[white]]rgb(255, 255, 255)[[/white]]
| [[white]]rgb(255, 255, 255)[[/white]] |
[[center]]
, [[left]]
, [[right]]
tags align (almost) everything. They're rendered to <div>
tag. So, don't forget to close them.
[[center]]
A centered text,
[[/center]] [[right]]
[[box]] and a right aligned box.[[/box]]
[[/right]]
You can insert icons with [[icon]]
tag, but it's not implemented yet.
[[blank]]
is rendered to
.
[[blank]]
syntect
's color palette.