2/25/2016 - 7:14 PM



Title: MaDer -- Yet Another Markdown Extension author: Andy Pan, Yu-Ren Pan

MaDer -- Yet Another Markdown Extension

By Andy Pan. Specification proposed by Yu-Ren Pan.

「讀我點媽的。」~WF, 2016

This extension is part of a project of mine in pursuit of more precise markups and better structured Markdown documents. Enjoy :)

Spec Extension

Spec is inherited from CommonMark, with the following additional syntax.

Generic elements

Usually we need to style or infer the content but Markdown don't provide us with class specification on all styled text, let alone customized elements. We extend the syntax to allow either block or inline elements. They are unstyled as default, but you can do it later with <style> blocks or by templates.

Note that we don't restrict whether generic elements "display" like an "inline" or a "block" one. They only differ from representation and default tag name choice.

Generic block ::

To enclose a block of text with a tag (div if not specified), an optional id, and class names, a block with a line starting with exactly 2 colons form a generic block, and the content starts from the next line.


:: p#id.class
the content is placed here.
    :: p#nested.another-class
    nestable: implemented as normal indentions

To escape, escape the first colon like \::.

Generic inline ::{ ... }

To enclose a piece of text, you can specify a tag name (span if not specified), etc.

::{span#id.class Hello world}

To escape within the markup, escape the } character; to escape the syntax, escape the first colon character :.

Metadata (TODO)

Taking adventage of the YAML front matter as <meta> tags or shortands to global layout property.

  • PDF meta data: title, author, subjects, keywords, date, generator.
  • Template path: Specify a list of (default | custom) CSS templates to be applied on. Path specification is the same as Node.js convention. (PROPOSED) (TODO)
  • Shortand CSS layout property: overrides the global variables used in default SASS stylesheet. Note that templates may ignore them by hard-coding the values instead. All these properties are specified under a layout object.
    • margins:
    • (TODO: define more properties)


Brings the sweet candy of C macros to Markdown.

[!define]: alert(y) <div class="alert">y</div> will transform
<div class="alert">hello</div>

(ISSUE: what content should be treated as parameters to be replaced?)

Include statement (TODO)

Replace the statement by including a file as its content.


Spec Modification

Some original spec may break with new features added. This list is some modifications made to be compatible with it.


To-do List


Written with StackEdit.