# remark-mentions

> remark plugin to replace @ mentions with links

Latest version **1.1.0** (published 2023-08-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install remark-mentions
pnpm add remark-mentions
yarn add remark-mentions
bun add remark-mentions
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2023-08-11 |
| First published | 2023-08-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | Finn Rayk Gärtner |
| Maintainers | finnrg |
| Keywords | unified, remark, remark-plugin, mdast, markdown, mentions, mention |

## Links

- npm: https://www.npmjs.com/package/remark-mentions
- Repository: https://github.com/FinnRG/remark-mentions
- Homepage: https://github.com/FinnRG/remark-mentions#readme
- Issues: https://github.com/FinnRG/remark-mentions/issues
- npm.io page: https://npm.io/package/remark-mentions

## Dependencies (4)

- [unified](https://npm.io/package/unified.md) ^10.1.2
- [@types/mdast](https://npm.io/package/@types/mdast.md) ^4.0.0
- [unist-util-visit](https://npm.io/package/unist-util-visit.md) ^5.0.0
- [mdast-util-find-and-replace](https://npm.io/package/mdast-util-find-and-replace.md) ^3.0.0

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2023-08-11
- 1.0.2 — 2023-08-01
- 1.0.1 — 2023-08-01
- 1.0.0 — 2023-08-01

## README

# remark-mentions

[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]

## What is this?

This package is a [unified][unified-link] ([remark][remark-link]) plugin to convert @ mentions to links: `@wooorm` -> `[**@wooorm**](https://github.com/wooorm)`.

**unified** is a project that transforms content with abstract syntax trees
(ASTs).
**remark** adds support for markdown to unified.
**mdast** is the markdown AST that remark uses.
This is a remark plugin that transforms mdast.

## Install

```sh
npm install remark-mentions
```

## Usage

```js
import {remark} from 'remark'
import remarkMentions from 'remark-mentions'

const markdown = "Hello @user!";

const file = await remark()
  .use(remarkMentions, {
    usernameLink: (username) => `/User/Profile/${username}`, // This is optional
  })
  .process(markdown)

console.log(String(file))
```

<!-- Definitions -->

[build-badge]: https://github.com/finnrg/remark-mentions/workflows/main/badge.svg

[build]: https://github.com/finnrg/remark-mentions/actions

[coverage-badge]: https://img.shields.io/codecov/c/github/finnrg/remark-mentions.svg

[coverage]: https://codecov.io/github/finnrg/remark-mentions

[unified-link]: https://github.com/unifiedjs/unified

[remark-link]: https://github.com/remarkjs/remark

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