FinnRG / remark-mentions

remark plugin to replace @ mentions with links

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

remark-mentions

Build Coverage

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))

About

remark plugin to replace @ mentions with links

License:MIT License


Languages

Language:JavaScript 100.0%