Crates.io | hmd |
lib.rs | hmd |
version | 0.4.13 |
source | src |
created_at | 2022-02-24 03:42:28.018623 |
updated_at | 2022-04-14 15:36:33.176646 |
description | Custom Markdown Engine for my personal blog. |
homepage | |
repository | https://github.com/baehyunsol/HMD |
max_upload_size | |
id | 538239 |
size | 465,108 |
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.
[[toc]]
Don't try edge cases! There must be tons of glitches.
Not at all.
<
, >
, 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 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
}
```
fn main() {
println!("Hello World!");
}
fn add_one(n: i32) -> bool {
n + 1
}
*
for emphasis, not _
.
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 H2O. 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.
<p><div class="box">A paragraph</p>
<p>Another paragraph</div></p>
It would look fine on most browsers, but not desirable though.
[[box]][[/box]]
is rendered to <div class="box"></div>
. It 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 inside a box. [[/box]] |
But you cannot have a table inside a box inside a table inside a box. |
Because you cannot put a table in another table. |
[[/box]]
[[big]][[/big]]
is rendered to <span class="size_big"></span>
.
HMD code | Rendered result |
---|---|
[[small]]Small font[[/small]] |
[[small]]Small font[[/small]] |
[[medium]]Medium font[[/medium]] |
[[medium]]Medium font[[/medium]] |
[[big]]Big font[[/big]] |
[[big]]Big font[[/big]] |
[[giant]]Giant font[[/giant]] |
[[giant]]Giant font[[/giant]] |
[[Big]]It's case insensitive![[/Big]] |
[[Big]]It's case insensitive![[/Big]] |
[[red]][[/red]]
is rendered to <span class="color_red"></span>
.
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]] |
Not only fonts!
[[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]]
[[icon=rust, size=128]]
You can insert icons with [[icon]]
tag. The documentation can be found here.
[[blank]]
is rendered to
.
Every single character in UTF-8 charset can be rendered with a [[char]]
tag. [[char=9650]]
is rendered to ▲
, which is [[char=9650]]. It only supports decimal representation, though. Older browsers may not support some characters.
[[toc]]
makes a table of content of the whole article. You cannot inline this tag!
[[math]] x=frac{-b pm sqrt{b sup{2}-4ac}}{2a} [[/math]]
is rendered to
[[center]] [[big]]
[[math]] x=frac{-b pm sqrt{b sup{2}-4ac}}{2a} [[/math]]
[[/big]] [[/center]]
For formulas to be rendered, <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
should be included in the rendered HTML file. The script is not supported on IE. For IE, you should include <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
.