Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/developit/snarkdown
:smirk_cat: A snarky 1kb Markdown parser written in JavaScript
https://github.com/developit/snarkdown
javascript markdown parser
Last synced: 20 days ago
JSON representation
:smirk_cat: A snarky 1kb Markdown parser written in JavaScript
- Host: GitHub
- URL: https://github.com/developit/snarkdown
- Owner: developit
- License: mit
- Created: 2014-11-05T01:16:49.000Z (almost 10 years ago)
- Default Branch: main
- Last Pushed: 2022-11-29T17:36:42.000Z (almost 2 years ago)
- Last Synced: 2024-10-10T14:52:54.653Z (24 days ago)
- Topics: javascript, markdown, parser
- Language: JavaScript
- Homepage: http://jsfiddle.net/developit/828w6t1x/
- Size: 202 KB
- Stars: 2,292
- Watchers: 27
- Forks: 109
- Open Issues: 42
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-markdown - Snarkdown - Snarkdown is a dead simple 1kb Markdown parser. (Libraries / JavaScript)
- awesome-github-star - snarkdown
- awesome-list - snarkdown
- awesome-node-esm - snarkdown - a snarky 1kb Markdown parser written in JavaScript (Packages / Parsing)
README
Snarkdown
Snarkdown is a dead simple **1kb** [Markdown] parser.
It's designed to be as minimal as possible, for constrained use-cases where a full Markdown parser would be inappropriate.
## Features
- **Fast:** since it's basically one regex and a huge if statement
- **Tiny:** it's 1kb of gzipped ES3
- **Simple:** pass a Markdown string, get back an HTML string> **Note:** Tables are not yet supported. If you love impossible to read regular expressions, submit a PR!
>
> **Note on XSS:** Snarkdown [doesn't sanitize HTML](https://github.com/developit/snarkdown/issues/70), since its primary target usage doesn't require it.## Demos & Examples
- ⚛️ [**Snarky**](https://snarky.surge.sh) - markdown editor built with Preact & Snarkdown
- ✏️ [**Simple Markdown Editor**](http://jsfiddle.net/developit/828w6t1x/)## Usage
Snarkdown exports a single function, which parses a string of Markdown and returns a String of HTML. Couldn't be simpler.
The snarkdown module is available in [every module format](https://unpkg.com/snarkdown/dist/) you'd ever need: ES Modules, CommonJS, UMD...
```js
import snarkdown from 'snarkdown';let md = '_this_ is **easy** to `use`.';
let html = snarkdown(md);
console.log(html);
// this is easy touse
.
```### Add-ons and Libraries
- For Webpack users, [`snarkdown-loader`](https://github.com/Plugin-contrib/snarkdown-loader) renders markdown files to html.
[Markdown]: http://daringfireball.net/projects/markdown/