README.md

# mork

[![Package Version](https://img.shields.io/hexpm/v/mork)](https://hex.pm/packages/mork)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/mork/)

__MÖRK__ is a Markdown parser written in pure Gleam, with the ambition to be
100% spec compliant with Commonmark and eventually to implement all of the
GFM Markdown extensions as well.

NOTE: Mörk is incomplete at the moment. Most of the Commonmark tests pass,
but there are bugs in the handling of lists and list items left to solve. For
most cases things should work fine, but in particular lazy paragraph
continuation within a list context and list items containing code blocks or
blockquotes are not handled correctly.

NOTE 2: This is a very early release of a new implementation of the Commonmark
spec, not using the C or javascript implementations at all. As such, it is
guaranteed to have bugs, differences in output and poor performance. Buyer
beware.

## Example

```sh
gleam add mork@1
```
```gleam
import simplifile
import mork

pub fn main() -> Nil {
  let readme = "./README.md"
  let assert Ok(markdown) = simplifile.read(from: readme)
  let html = markdown |> mork.parse |> mork.to_html
  let assert Ok(_) = html |> simplifile.write(to: "README.html")
}
```

Further documentation can be found at <https://hexdocs.pm/mork>.

## Development

```sh
gleam run   # Run the project
gleam test  # Run the tests
gleam test tabs # Run only the Tabs section of tests
gleam test tabs 9 # Run only example number 9 from the test section
gleam test custom # Run only extra tests (not from the spec)
```

## Requirements

- Gleam 1.13+
- Erlang 28+ (due to PCRE2 usage)

The goal is to run on the Javascript target as well, but I haven't
tested this yet and the regular expressions work differently there
so it is unlikely to work right now.