remark-mentions
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

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

/remark-mentions/

    Package Sidebar

    Install

    npm i remark-mentions

    Weekly Downloads

    1,370

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    5.96 kB

    Total Files

    7

    Last publish

    Collaborators

    • finnrg