No description
Find a file
2021-08-15 05:39:26 +09:00
src updated global variables to const for gcsafety 2021-08-14 12:13:19 -07:00
testfiles Fix entity 2021-05-02 15:53:02 +09:00
tests clean 2021-06-05 04:05:35 +08:00
.gitignore clean 2021-06-05 04:05:35 +08:00
LICENSE Add LICENSE 2021-04-25 07:09:01 +00:00
nmark.nimble Ver 0.1.10 2021-08-15 05:39:26 +09:00
perfcmp.md Ver 0.1.10 2021-08-15 05:39:26 +09:00
README.md Replace 'parser' with 'converter', which fits the actual usage 2021-06-05 14:54:44 +09:00

nmark

Fast markdown converter, based on CommonMark, written in Nim.

Usage

import nmark

let txt = """
> Lorem ipsum dolor
sit amet.
> - Qui *quodsi iracundia*
> - aliquando id
"""

echo txt.markdown

...and it's done.

# output
<blockquote>
<p>Lorem ipsum dolor
sit amet.</p>
<ul>
<li>Qui <em>quodsi iracundia</em></li>
<li>aliquando id</li>
</ul>
</blockquote>

table

You can use tables in nmark.

| abc | defghi |
:-: | -----------:
bar | baz

is converted to:

<table>
<thead>
<tr>
<th align="center">abc</th>
<th align="right">defghi</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">bar</td>
<td align="right">baz</td>
</tr>
</tbody>
</table>

(Tables need to be separated from other blocks by empty line.)

Performance comparison

One of the reason I'm working on this is that other markdown librarys written in Nim seemed relatively slow. Here is a comparison between nim-markdown, which I think is the standard Nim markdown parser, and nmark, through a static site generator(which, btw, I made) and hyperfine.

Perfomance comparison detail

As shown above, with nmark it is about 4 times faster than with nim-markdown for now.

Caution

This is still work-in-progess project, and does not FULLY pass the spec-test of CommonMark. For example,

> foo
bar
===

is, by nmark, converted to:

<blockquote>
<h1>foo
bar</h1>
</blockquote>

I'm working on improving the accuracy and performance. Issues, pull requests always welcome.