remark-mentions
v1.1.0
Published
remark plugin to replace @ mentions with links
Downloads
3,872
Maintainers
Readme
remark-mentions
What is this?
This package is a unified (remark) 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
npm install remark-mentions
Usage
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))