retext-syntax-urls

retext plugin to classify url-like values as syntax, not natural language

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
retext-syntax-urls
703.1.2a year ago5 years agoMinified + gzip package size for retext-syntax-urls in KB

Readme

retext-syntax-urls
!Buildbuild-badgebuild !Coveragecoverage-badgecoverage !Downloadsdownloads-badgedownloads !Sizesize-badgesize !Sponsorssponsors-badgecollective !Backersbackers-badgecollective !Chatchat-badgechat
retextretext plugin to classify url-like values (example.com, index.html, www.alpha.bravo) as syntaxsource, not natural language.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.
npm install retext-syntax-urls
## Use

Without `syntax-urls`:

```js
import dictionary from 'dictionary-en-gb'
import {reporter} from 'vfile-reporter'
import {unified} from 'unified'
import retextEnglish from 'retext-english'
import retextSpell from 'retext-spell'
import retextSyntaxUrls from 'retext-syntax-urls'
import retextStringify from 'retext-stringify'

unified()
  .use(retextEnglish)
  .use(retextSpell, dictionary)
  .use(retextStringify)
  .process('Have you read readme.md? Check it out: www.example.com/readme.md')
  .then((file) => {
    console.log(reporter(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(retextEnglish)
+  .use(retextSyntaxUrls)
.use(retextSpell, dictionary)

Yields:
no issues found

API

This package exports no identifiers. The default export is retextSyntaxUrls.

unified().use(retextSyntaxUrls)

Classify URLs, paths, and filenames as sourcesource, which represent “external (ungrammatical) values” instead of natural language. This hides them from retext-spellspell, retext-readabilityreadability, retext-equalityequality, and more.

Related

— Classify [**@mentions**](https://github.com/blog/821) as syntax
— Check spelling
— Check readability
— Check possible insensitive, inconsiderate language

Contribute

See contributing.mdcontributing in retextjs/.githubhealth for ways to get started. See support.mdsupport for ways to get help.
This project has a code of conductcoc. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MITlicense © Titus Wormerauthor