Skip to content

soasme/nim-markdown

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 

Nim-markdown

nim-markdown is a Markdown Parser in the Nim world.

Documentation Build Status

Install

Install via nimble in your project root.

$ nimble install markdown

# or with current stable version
$ nimble install markdown@">= 0.8.0"

# or with the latest version
$ nimble install markdown@#head

Library Usage

Below is the minimal usage of using markdown as a library.

# 1. import pkg.
import markdown

# 2. transform md to html.
let html = markdown("# Hello World\nHappy writing Markdown document!")

# 3. do something :)
echo(html)

Below are some useful links:

Binary Usage

The usage of binary markdown is as below:

# Read from stdin and write to stdout.
$ markdown < README.md > README.html

Development

Build markdown binary:

$ nimble build

Test markdown modules:

$ nimble test

Build document:

$ nim doc --project --git.url=https://github.com/soasme/nim-markdown --git.commit=v0.7.0 src/markdown.nim

The Markdown Parser serves as a guidance on the implementation of nim-markdown, or in any generic programming language.

Roadmap

Priorities:

  • Support Commonmark.
  • Support GFM.
  • Support writing extensions.
  • Benchmark.

Features:

  • Thematic Break
  • Heading
  • Indented code block
  • Fence code block
  • Block Quote
  • Ordered/Unordered List
  • Nested lists
  • Raw HTML block
  • Table
  • Ref Link
  • Inline Link
  • Auto link
  • Image Link
  • Emphasis
  • Double Emphasis
  • Strikethrough
  • Link Break
  • Inline Code
  • Inline HTML
  • Escape
  • Paragraph
  • Auto link (extension)
  • Footnote
  • Want new features? Issues or pull requests are welcome. ;)

ChangeLog

Released:

  • v0.8.7, 25 Feb 2023, bugfix: allow whitespace and tab after code closing fence. #64.
  • v0.8.6, 9 Jul 2022, bugfix: export no internal procs.
  • v0.8.5, 19 Mar 2021, bugfix: codespan might be empty. #42.
  • v0.8.4, 19 Mar 2021, performance improvement: eliminate all firstLine and restLines calls. (#54, #55, #56).
  • v0.8.3, 13 Mar 2021, performance improvement: faster html pattern matching (#52) & eliminate all since() calls (#53).
  • v0.8.2, 3 Mar 2021, performance improvement: use pre-compiled regex.
  • v0.8.1, 30 Dec 2019, bugfix: fixed compatibility with --gc:arc.
  • v0.8.0, 8 Sep 2019, bugfix: gcsafe with nim --threads:on.
  • v0.7.2, 8 Sep 2019, rename internal package to markdownpkg.
  • v0.7.1, 7 Sep 2019, removed useless constants.
  • v0.7.0, 6 Sep 2019, support parsing in commonmark v0.29 syntax.
  • v0.5.4, 1 Aug 2019, bugfix: improved the ul & ol parsing.
  • v0.5.3, 3 Jun 2019, bugfix: Added import exceptions for strip and splitWhitespace from unicode #20.
  • v0.5.2, 5 Nov 2018, bugfix: ambiguous call.
  • v0.5.1, 4 Nov 2018, inline email support; bugfix: \u00a0 causing build error #16, etc.
  • v0.5.0, 3 Nov 2018, bugfix: links in lists not working (#14), etc.
  • v0.4.0, 27 Oct 2018, support ~~~ as fence mark, etc. #12.
  • v0.3.4, 24 Oct 2018, support hard line breaks (gfm 6.12).
  • v0.3.3, 23 Oct 2018, strict-typed config (#5), add cli options.
  • v0.3.2, 23 Oct 2018, support setext heading.
  • v0.3.1, 22 Oct 2018, bugfix: soft line breaks (gfm 6.13).
  • v0.3.0, 22 Oct 2018, support html table block (#3).
  • v0.2.0, 20 Oct 2018, package published nim-lang/packages#899.
  • v0.1.2, 19 Oct 2018, add parameter config to proc markdown & support [url](<text> "title").
  • v0.1.1, 18 Oct 2018, import from markdown instead markdownpkg/core.
  • v0.1.0, 17 Oct 2018, initial release.

License

Nim-markdown is based on MIT license.