# tinymd

> Tiny markdown processor

Latest version **1.0.1** (published 2017-11-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install tinymd
pnpm add tinymd
yarn add tinymd
bun add tinymd
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-11-15 |
| First published | 2017-07-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Felix Gnass |
| Maintainers | fgnass |
| Keywords | markdown, browser, node, lightweight |

## Links

- npm: https://www.npmjs.com/package/tinymd
- Repository: https://github.com/fgnass/tinymd
- Homepage: https://github.com/fgnass/tinymd#readme
- Issues: https://github.com/fgnass/tinymd/issues
- npm.io page: https://npm.io/package/tinymd

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-11-15
- 1.0.0 — 2017-09-18
- 0.0.3 — 2017-08-21
- 0.0.2 — 2017-07-27
- 0.0.1 — 2017-07-27

## README

# tinymd 💃

[![Build Status](https://travis-ci.org/fgnass/tinymd.svg?branch=master)](https://travis-ci.org/fgnass/tinymd) ![Bundle size](http://img.badgesize.io/https://unpkg.com/tinymd?compression=gzip)

## Why

All other solutions were either _too large_ to be used in webapps where bundle size is important or _too constraint_ (like missing support for paragraphs or nested lists).

Tinymd tries to strike a good balance between size and features. It's fully tested and works in browsers as well as in Node.

The underlying parsing alorithm is heavily based on Vladimir Antonov's [nano-markdown](https://github.com/Holixus/nano-markdown) implementation.

## Basic Usage

```js
import tinymd from 'tinymd';

const opts = {};
const html = tinymd('', opts);
```

### Supported markdown syntax

```markdown
# tinymd

supports ...

* lists
  - nested lists
    1. ordered
    2. with [links](http://example.com)
  - ![images](/cat.jpg)
  - rulers

----

All ~~common~~ **inline** _styles_

    code blocks
    rulers

And \[escaping]\(of special chars).
```

## Options

### Target _blank

By default all links starting with `+` will get `target="_blank"` attribute. You can customize this behavior by providing an `isBlank` function:

```js
tinynmd('[link](http://example.com)', {
  isBlank: ref => ~ref.indexOf('://')
  }
};
```

### Rewriting URLs

You can rewrite all links and image sources by providing a `rewrite` function:

```js
tinynmd('[Issue 42](#42)', {
  rewrite: s => {
    const m = /^#(\d+)/.exec(s);
    return m ? `/issue${m[1]}` : s;
  }
};
```

### Adding headline anchors

```js
tinynmd('# hello world', { addIds: true });
// <h1 id="hello_world">hello world</h1>
```

## License

MIT

---
_Source: https://npm.io/package/tinymd · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
