https://github.com/openpeeps/marvdown
This is Marvdown ⚡️ A stupid simple Markdown parser, cli app & native addon for NodeJS / Bun. 👑 Written in Nim language
https://github.com/openpeeps/marvdown
Last synced: 3 months ago
JSON representation
This is Marvdown ⚡️ A stupid simple Markdown parser, cli app & native addon for NodeJS / Bun. 👑 Written in Nim language
- Host: GitHub
- URL: https://github.com/openpeeps/marvdown
- Owner: openpeeps
- Created: 2022-02-12T20:30:12.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-11-18T21:17:35.000Z (over 1 year ago)
- Last Synced: 2025-01-21T14:15:38.897Z (over 1 year ago)
- Language: Nim
- Homepage:
- Size: 407 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-nim - Marvdown - A stupid simple Markdown parser. (Data / Parsing)
README

This is Marvdown ⚡️ A stupid simple Markdown parser
nimble install marvdown / npm install @openpeeps/marvdown
> [!NOTE]
> Marv is still in early development. Some features are not fully implemented yet. Contributions are welcome!
## 😍 Key Features
- [x] Extremely Fast & Lightweight! [Check benchmarks](#benchmarks)
- [x] Compiled cross-platform CLI app
- [x] Nim library for easy integration in your 👑 Nim projects
- [x] Addon for Node.js JavaScript runtime via N-API
- [x] Markdown to HTML
- [x] Auto-generate Table of Contents (ToC)
- [x] Auto-generate heading IDs for anchor links
- [ ] Markdown to PDF
- [x] Markdown to JSON (structured data)
- [ ] GitHub Flavored Markdown (GFM)
## About
Marv is a stupid simple markdown parser written in [Nim](https://nim-lang.org). It can be used as a library in your Nim projects or as a CLI tool to convert markdown files to HTML. Currently, it supports basic markdown syntax like headings, paragraphs, bold, italic, links, images, lists, blockquotes, code blocks and inline code.
## Installing
Install Marvdown via [Nimble](https://nim-lang.org/docs/nimble.html)
```
nimble install marvdown
```
For Node.js install Marvdown via [npm](https://www.npmjs.com/package/@openpeeps/marvdown)
A GitHub action will build the binary CLI app and Node.js addon evertime a new release is published. Download the latest version of Marvdown from the [Github releases page](https://github.com/openpeeps/marvdown/releases).
## Example Usage
Using Marvdown from the command line is super easy. Just run:
```
marvdown html sample.md --optAnchors --bench
```
Enable anchor generations for headings with `--optAnchors` flag. Run benchmarks with `--bench` flag.
### Programming with Marvdown
In Nim language the fastest way to convert markdown to HTML is to use the `toHtml()` proc.
```nim
import marvdown
echo marvdown.toHtml(readFile("sample.md"))
```
In JavaScript or TypeScript you can load the N-API addon and use the `toHtml()` function.
```js
const fs = require('fs');
const marvdown = require('@openpeeps/marvdown')
let output = marvdown.toHtml(fs.readFileSync('sample.md', 'utf8'))
console.log(output)
```
_todo: example of custom options_
For more examples, see the [/examples folder](#). Also check out the [API reference](https://openpeeps.github.io/marvdown/) for more details 👌
### Benchmarks
Marvdown is super fast! It can parse large markdown files in milliseconds. Here is a quick benchmark
over 100K lines of markdown text (~5.3 MB)
```
Benchmark 1: marvdown html bigdoc.md
Time (abs ≡): 188.1 ms [User: 166.9 ms, System: 19.8 ms]
```
_Benchmark made with [hyperfine](https://github.com/sharkdp/hyperfine)_
### ❤ Contributions & Support
- 🐛 Found a bug? [Create a new Issue](https://github.com/openpeeps/marvdown/issues)
- 👋 Wanna help? [Fork it!](https://github.com/openpeeps/marvdown/fork)
- 😎 [Get €20 in cloud credits from Hetzner](https://hetzner.cloud/?ref=Hm0mYGM9NxZ4)
- 🥰 [Donate to OpenPeeps via PayPal address](https://www.paypal.com/donate/?hosted_button_id=RJK3ZTDWPL55C)
### Credits
Original illustration made by 💙 [Olha](https://www.deviantart.com/jo316) remixed with Sora.
### 🎩 License
**Marv** | [MIT License](https://github.com/openpeeps/marvdown/blob/main/LICENSE).
[Made by Humans from OpenPeeps](https://github.com/openpeeps).
Copyright © 2024 OpenPeeps & Contributors — All rights reserved.