# ssb-markdown

> patchwork's markdown parser

Latest version **6.0.7** (published 2020-04-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install ssb-markdown
pnpm add ssb-markdown
yarn add ssb-markdown
bun add ssb-markdown
```

## 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 | 6.0.7 |
| Published | 2020-04-02 |
| First published | 2016-01-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 34.7 KB |
| Known vulnerabilities | 0 (+6 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Paul Frazee |
| Maintainers | ahdinosaur, aljoscha-meyer, andregarzia, arj03, cel, chereseeriepa, christianbundy, cryp7ix, dominictarr, happy0, kyphae, luandro, mixmix, mmckegg, noffle, pfraze, pfrazee, pietgeursen, regular, staltz, vtduncan |

## Links

- npm: https://www.npmjs.com/package/ssb-markdown
- Repository: https://github.com/ssbc/ssb-markdown
- Issues: https://github.com/ssbc/ssb-markdown/issues
- npm.io page: https://npm.io/package/ssb-markdown

## Dependencies (8)

- [ssb-ref](https://npm.io/package/ssb-ref.md) ^2.13.9
- [node-emoji](https://npm.io/package/node-emoji.md) ^1.10.0
- [emoji-regex](https://npm.io/package/emoji-regex.md) ^8.0.0
- [markdown-it](https://npm.io/package/markdown-it.md) ^10.0.0
- [highlight.js](https://npm.io/package/highlight.js.md) ^9.18.1
- [hashtag-regex](https://npm.io/package/hashtag-regex.md) ^2.1.0
- [markdown-it-emoji](https://npm.io/package/markdown-it-emoji.md) ^1.4.0
- [markdown-it-hashtag](https://npm.io/package/markdown-it-hashtag.md) ^0.4.0

## Recent versions

- 6.0.7 (latest) — 2020-04-02
- 6.0.6 — 2020-03-25
- 6.0.5 — 2020-03-11
- 6.0.4 — 2020-02-24
- 6.0.3 — 2020-01-26
- 6.0.2 — 2019-12-28
- 6.0.1 — 2019-12-28
- 6.0.0 — 2019-09-26
- 5.1.3 — 2019-08-20
- 5.1.2 — 2019-08-20
- 5.1.1 — 2019-08-20
- 5.1.0 — 2019-08-20
- 5.0.2 — 2019-07-29
- 5.0.1 — 2019-06-16
- 5.0.0 — 2019-06-15
- … 20 more at https://npm.io/package/ssb-markdown/versions

## README

# ssb-markdown

render patchwork/ssb messages to markdown.

[patchwork](https://github.com/ssbc/patchwork) has a few changes from
standard markdown.

* emoji - everybody hearts emoji
* ssb links - links to cryptographic objects see [ssb-ref](https://github.com/ssbc/ssb-ref)
* mentions - @mentions like on twitter or github. mentions allow people to convieniently talk to each other, but are written as both the name used, plus the cryptographic reference.

## api

```
var md = require('ssb-markdown')
```

### md.block(source, opts)

Render raw markdown `source` to html.
The output will be html content without a surrounding tag.

### md.inline (source, opts)

Render raw markdown to a single line of test,
suitable for a one line preview that is opened
to a view rendered with `block`.

### opts

An object containing custom markdown rendering functions. `opts` are the
same for both `md.block` and `md.inline`

`toUrl` is a function which accepts an [ssb-ref](https://github.com/ssbc/ssb-links) or @-mention string, and whether it is for an image or not,
and returns a url string.


`imageLink` is a function which accepts an [ssb-ref](https://github.com/ssbc/ssb-links) and will be used to generate links to wrap any images.

`emoji` is a function which accepts an emoji as markup and
over-rides the default emoji rendering behavior.


#### usage

```js
const opts = {
  toUrl: ref => renderUrlRef(ref),
  imageLink: ref => renderImageRef(ref),
  emoji: emojiAsMarkup => renderEmoji(emojiAsMarkup)
}

md.block(source, opts)

md.inline(source, opts)
```

## License

MIT

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