Skip to content
/ koino Public

CommonMark + GFM compatible Markdown parser and renderer

License

Notifications You must be signed in to change notification settings

kivikakk/koino

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build status Spec Status: 671/671

Zig port of Comrak. Maintains 100% spec-compatibility with GitHub Flavored Markdown.

Getting started

Using koino as a library

  • Get Zig 0.12 https://ziglang.org/

  • Start a new project with zig init-exe / zig init-lib

  • Add koino via the zig package manager:

    $ zig fetch --save https://github.com/kivikakk/koino/archive/<commit hash>.tar.gz
  • Add the following to your build.zig's build function:

    const koino_pkg = b.dependency("koino", .{ .optimize = optimize, .target = target });
    exe.root_module.addImport("koino", koino_pkg.module("koino"));
  • Have a look at the bottom of parser.zig to see some test usage.

Using it as a CLI executable

  • Clone this repository:
    $ git clone https://github.com/kivikakk/koino
  • Build
    $ zig build
  • Use ./zig-out/bin/koino

For development purposes

  • Clone this repository with submodules for the cmark-gfm dependency:

    $ git clone --recurse-submodules https://github.com/kivikakk/koino
    $ cd koino
  • Build and run the spec suite.

    $ zig build test
    $ make spec

Usage

Command line:

$ koino --help
Usage: koino [-hu] [-e <EXTENSION>...] [--smart]

Options:
        -h, --help                      Display this help and exit
        -u, --unsafe                    Render raw HTML and dangerous URLs
        -e, --extension <EXTENSION>...  Enable an extension. (table,strikethrough,autolink,tagfilter)
            --smart                     Use smart punctuation.

Library:

Documentation is TODO — see LoLa for an example of use. Note also the build.zig declaration.