unified

Project:retextjs/retext-syntax-urls

Package:retext-syntax-urls@2.0.0

  1. Dependencies:4·Dependents:8
  2. retext plugin to classify url-like values as syntax, not natural language
  1. unified 135
  2. plugin 123
  3. retext 33
  4. syntax 30
  5. retext-plugin 20
  6. url 9
  7. source 3
  8. path 3

retext-syntax-urls

Build Coverage Downloads Size Sponsors Backers Chat

retext plugin to classify url-like values (example.com, index.html, www.alpha.bravo) as syntax, not natural language.

Install

npm:

npm install retext-syntax-urls

Use

Without syntax-urls:

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 urls = require('retext-syntax-urls')
var report = require('vfile-reporter')

unified()
  .use(english)
  .use(spell, dictionary)
  .use(stringify)
  .process(
    'Have you read readme.md? Check it out: www.example.com/readme.md',
    function(err, file) {
      console.log(report(err || file))
    }
  )

Yields:

  1:15-1:24  warning  `readme.md` is misspelt        retext-spell  retext-spell
  1:40-1:55  warning  `www.example.com` is misspelt  retext-spell  retext-spell
  1:56-1:65  warning  `readme.md` is misspelt        retext-spell  retext-spell

⚠ 3 warnings

With syntax-urls:

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

Yields:

no issues found

API

retext().use(urls)

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

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, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer