retext-syntax-mentions-channels

retext plugin to classify @mentions and #channels as syntax, not natural language

Usage no npm install needed!

<script type="module">
  import retextSyntaxMentionsChannels from 'https://cdn.skypack.dev/retext-syntax-mentions-channels';
</script>

README

retext-syntax-mentions-channels

Build Coverage Downloads Size Sponsors Backers Chat

retext plugin to classify @mentions as syntax, not natural language. It also ignores chat channels like the ones used on Slack, for example #this-is-a-channel.

DISCLAIMER: This is a modified version of retext-syntax-mentions. There are some links in the documentation that are still mentioning this project as its original name.

Install

npm:

npm install retext-syntax-mentions-channels

Use

Without syntax-mentions-channels:

var dictionary = require('dictionary-en-gb')
var unified = require('unified')
var english = require('retext-english')
var stringify = require('retext-stringify')
var spell = require('retext-spell')
var mentions = require('retext-syntax-mentions-channels')
var report = require('vfile-reporter')

unified()
  .use(english)
  .use(spell, dictionary)
  .use(stringify)
  .process('Misspelt? @wooorm.', function(err, file) {
    console.log(report(err || file))
  })

Yields:

  1:12-1:18  warning  `wooorm` is misspelt; did you mean `worm`?  retext-spell  retext-spell

⚠ 1 warning

With syntax-mentions-channels:

   .use(english)
+  .use(mentions)
   .use(spell, dictionary)

Yields:

no issues found

API

retext().use(mentions)

Classify @mentions as source, which represent “external (ungrammatical) values” instead of natural language. This hides mentions from retext-spell, retext-readability, retext-equality, and more.

Related

Contribute

See contributing.md in retextjs/.github for ways to get started. See support.md for ways to get help.

This project has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.

License

MIT © Titus Wormer