Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/metagn/margrave

Markdown dialect
https://github.com/metagn/margrave

articles html markdown nim parser pure

Last synced: about 1 month ago
JSON representation

Markdown dialect

Awesome Lists containing this project

README

        

# margrave

Tweakable parser for a dialect of markdown that generates an HTML-like
representation, which can be converted to HTML. Not stable.
[Try in browser](https://metagn.github.io/margrave/browser/converter.html).
[Docs](https://metagn.github.io/margrave/docs/margrave.html)

Tested for C, JS and NimScript (so also VM).

Input file ref.mrg:

````markdown
To escape use \\

# Heading1
## Heading2
### Heading3
#### Heading4
##### Heading5
###### Heading6

####{heading-id} Heading (new, makes heading-id the id of this heading)

* Bullet points
+ Plus
- Minus

1. Numbered list
2. Can be
4. Any number
. or just a dot (new),
can also indent

> Blockquotes
>
> can _be_ **formatted**

```
Code blocks
Have no formatting

HTML & chars < automatically > escaped
```

Inline formatting:

Link: [text](url)
[text **can have formatting**](url "tooltip text")
Image: ![](url)
![alt text (image doesnt load)](url "tooltip text")
Superscript (new): 4^(3) = 64
Subscript (new): a[n] = 2n + 1
Bold: **text**
Underline: __text__
italic: *text* _text_
Strikethrough: ~~text~~
Inline code (has formatting!): `text`
Checkboxes anywhere in the document, not just lists: [ ] [x]
Unformatted text with curly braces (new): {aaa **aaa** __aaa__}
Raw curly braces (HTML chars left unescaped): {! foo bar}
Nested curly braces: {aa {bb} cc {dd {ee}} ff}
Inline code without formatting: `{1 < 3 ? _ * 3 + 3 * _ + 2 ** 2 ** 2 : 4 & 2}`

Inline HTML (no formatting inside, raw curly braces might be better):


a 1
a 2


b 1
b 2

````

outputs to ref.html:

```HTML

To escape use \


Heading1


Heading2


Heading3


Heading4


Heading5

Heading6

Heading (new, makes heading-id the id of this heading)



  • Bullet points

  • Plus

  • Minus



  1. Numbered list

  2. Can be

  3. Any number

  4. or just a dot (new),
    can also indent



Blockquotes

can be formatted



Code blocks

Have no formatting

HTML & chars < automatically > escaped


Inline formatting:


Link: text
text can have formatting
Image:
alt text (image doesnt load)
Superscript (new): 43 = 64
Subscript (new): an = 2n + 1
Bold: text
Underline: text
italic: text text
Strikethrough: text
Inline code (has formatting!): text
Checkboxes anywhere in the document, not just lists:
Unformatted text with curly braces (new): aaa **aaa** __aaa__
Raw curly braces (HTML chars left unescaped): foo bar
Nested curly braces: aa {bb} cc {dd {ee}} ff
Inline code without formatting: 1 < 3 ? _ * 3 + 3 * _ + 2 ** 2 ** 2 : 4 & 2


Inline HTML (no formatting inside, raw curly braces might be better):




a 1
a 2


b 1
b 2

```