https://github.com/metagn/margrave
Markdown dialect
https://github.com/metagn/margrave
articles html markdown nim parser pure
Last synced: about 1 year ago
JSON representation
Markdown dialect
- Host: GitHub
- URL: https://github.com/metagn/margrave
- Owner: metagn
- Created: 2020-10-01T08:30:53.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-10-11T13:44:56.000Z (over 1 year ago)
- Last Synced: 2024-10-14T15:03:31.322Z (over 1 year ago)
- Topics: articles, html, markdown, nim, parser, pure
- Language: Nim
- Homepage: https://metagn.github.io/margrave/browser/converter.html
- Size: 176 KB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
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: 

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
- Numbered list
- Can be
- Any number
- or just a dot (new),
can also indent
Blockquotes
can be formatted
Code blocks
Have no formattingHTML & chars < automatically > escaped
Inline formatting:
Link: text
text can have formatting
Image:
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
```