Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kivikakk/koino
CommonMark + GFM compatible Markdown parser and renderer
https://github.com/kivikakk/koino
commonmark markdown zig
Last synced: 7 days ago
JSON representation
CommonMark + GFM compatible Markdown parser and renderer
- Host: GitHub
- URL: https://github.com/kivikakk/koino
- Owner: kivikakk
- License: mit
- Created: 2020-08-12T07:24:47.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-01T23:10:59.000Z (7 months ago)
- Last Synced: 2025-01-13T05:03:25.877Z (13 days ago)
- Topics: commonmark, markdown, zig
- Language: Zig
- Homepage: https://hrzn.ee/kivikakk/koino
- Size: 223 KB
- Stars: 132
- Watchers: 6
- Forks: 13
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-zig - kivikakk/koino
- awesome-zig - koino🗒️CommonMark + GFM compatible Markdown parser and renderer
README
# [koino](https://github.com/kivikakk/koino)
![Build status](https://github.com/kivikakk/koino/workflows/Zig/badge.svg)
![Spec Status: 671/671](https://img.shields.io/badge/specs-671%2F671-brightgreen.svg)Zig port of [Comrak](https://github.com/kivikakk/comrak). Maintains 100% spec-compatibility with [GitHub Flavored Markdown](https://github.github.com/gfm/).
## Getting started
## Using koino as a library
* Get Zig 0.12 https://ziglang.org/
* Using Zig 0.13? See [`zig-0.13.0`](https://github.com/kivikakk/koino/tree/zig-0.13.0) branch.
* Start a new project with `zig init-exe` / `zig init-lib`
* Add koino via the zig package manager:
```console
$ zig fetch --save https://github.com/kivikakk/koino/archive/.tar.gz
```
* Add the following to your `build.zig`'s `build` function:
```zig
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`](https://github.com/kivikakk/koino/blob/main/src/parser.zig) to see some test usage.
### Using it as a CLI executable
* Clone this repository:
```console
$ git clone https://github.com/kivikakk/koino
```
* Build
```console
$ zig build
```
* Use `./zig-out/bin/koino`### For development purposes
* Clone this repository with submodules for the `cmark-gfm` dependency:
```console
$ git clone --recurse-submodules https://github.com/kivikakk/koino
$ cd koino
```* Build and run the spec suite.
```console
$ zig build test
$ make spec
```## Usage
Command line:
```console
$ koino --help
Usage: koino [-hu] [-e ...] [--smart]Options:
-h, --help Display this help and exit
-u, --unsafe Render raw HTML and dangerous URLs
-e, --extension ... Enable an extension. (table,strikethrough,autolink,tagfilter)
--smart Use smart punctuation.
```Library:
Documentation is TODO — see [LoLa](https://github.com/MasterQ32/LoLa/blob/d02b0e6774fedbe07276d8af51e1a305cc58fb34/src/tools/render-md-page.zig#L157) for an example of use. Note also the [`build.zig`](https://github.com/MasterQ32/LoLa/blob/d02b0e6774fedbe07276d8af51e1a305cc58fb34/build.zig#L41-L50) declaration.