Skip to content

Commit

Permalink
docs: Add README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
FinnRG committed Aug 1, 2023
1 parent 597a138 commit 7d98aa6
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# remark-mentions

[![Build][build-badge]][build]
[![Coverage][coverage-badge]][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

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

0 comments on commit 7d98aa6

Please sign in to comment.