# @backhq/mrkdwn-parse

> Slack mrkdwn parser for unified

Latest version **0.0.3** (published 2021-01-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @backhq/mrkdwn-parse
pnpm add @backhq/mrkdwn-parse
yarn add @backhq/mrkdwn-parse
bun add @backhq/mrkdwn-parse
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2021-01-28 |
| First published | 2020-03-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 16 |
| Unpacked size | 42.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | rstrom |

## Links

- npm: https://www.npmjs.com/package/@backhq/mrkdwn-parse
- npm.io page: https://npm.io/package/@backhq/mrkdwn-parse

## Dependencies (16)

- [trim](https://npm.io/package/trim.md) 0.0.1
- [xtend](https://npm.io/package/xtend.md) ^4.0.1
- [unherit](https://npm.io/package/unherit.md) ^1.0.4
- [emoji-js](https://npm.io/package/emoji-js.md) ^3.5.0
- [is-decimal](https://npm.io/package/is-decimal.md) ^1.0.0
- [state-toggle](https://npm.io/package/state-toggle.md) ^1.0.0
- [repeat-string](https://npm.io/package/repeat-string.md) ^1.5.4
- [parse-entities](https://npm.io/package/parse-entities.md) ^1.1.0
- [vfile-location](https://npm.io/package/vfile-location.md) ^2.0.0
- [is-alphabetical](https://npm.io/package/is-alphabetical.md) ^1.0.0
- [markdown-escapes](https://npm.io/package/markdown-escapes.md) ^1.0.0
- [is-word-character](https://npm.io/package/is-word-character.md) ^1.0.0
- [trim-trailing-lines](https://npm.io/package/trim-trailing-lines.md) ^1.0.0
- [collapse-white-space](https://npm.io/package/collapse-white-space.md) ^1.0.2
- [is-whitespace-character](https://npm.io/package/is-whitespace-character.md) ^1.0.0
- [unist-util-remove-position](https://npm.io/package/unist-util-remove-position.md) ^1.0.0

## Recent versions

- 0.0.3 (latest) — 2021-01-28
- 0.0.2 — 2020-03-23
- 0.0.1 — 2020-03-23

## README

# slack-parse

Based on [**@tagplay/slack-parse**][@tagplay/slack-parse], which was originally based on [**remark-parse**][remark-parse], modified to parse Slack's not-Markdown.

It assumes some simple transformations have been made beforehand, for sanity:

- converting Slack's special links into regular Markdown links according to Slack's [instructions](https://api.slack.com/docs/message-formatting#how_to_display_formatted_messages)
- since this means we'll be parsing regular Markdown link syntax, any square brackets in the actual message should be rendered as &lsqb; and &rsqb; beforehand
- as Slack returns angle brackets *not* involved in its link syntax as HTML entities, including those that are meant to be parsed as Markdown syntax, those should be decoded before parsing
- if an exclamation mark directly precedes a Slack link, it must be escaped, since otherwise the resulting Markdown syntax will look like an image
- however, since you can't escape characters in Slack (all backslashes are literal), all actual backslashes in the Slack text must be escaped

This is overly complex and hacky and on the whole this kind of sucks, but it works.

## Modifications

- Render emoji shortcodes in text as emojis
- Parse mentions as links w/ href `#mention`
- Detect URLs
- Don't render links/images
- Returns as root element, rather than paragraph

[@tagplay/slack-parse]: https://github.com/tagplay/slack-parse
[remark-parse]: https://www.npmjs.com/package/remark-parse

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