Comparing version 14.0.3 to 15.0.0
@@ -1,6 +0,11 @@ | ||
export const remark: import('unified').FrozenProcessor< | ||
import('mdast').Root, | ||
import('mdast').Root, | ||
import('mdast').Root, | ||
string | ||
> | ||
/// <reference types="remark-parse" /> | ||
/// <reference types="remark-stringify" /> | ||
import type {Root} from 'hast' | ||
import type {Processor} from 'unified' | ||
/** | ||
* Create a new unified processor that already uses `remark-parse` and | ||
* `remark-stringify`. | ||
*/ | ||
export const remark: Processor<Root, undefined, undefined, Root, string> |
@@ -1,5 +0,10 @@ | ||
import {unified} from 'unified' | ||
// Note: types exposed from `index.d.ts` | ||
import remarkParse from 'remark-parse' | ||
import remarkStringify from 'remark-stringify' | ||
import {unified} from 'unified' | ||
/** | ||
* Create a new unified processor that already uses `remark-parse` and | ||
* `remark-stringify`. | ||
*/ | ||
export const remark = unified().use(remarkParse).use(remarkStringify).freeze() |
{ | ||
"name": "remark", | ||
"version": "14.0.3", | ||
"description": "unified processor with support for parsing markdown input and serializing markdown as output", | ||
"version": "15.0.0", | ||
"description": "markdown processor powered by plugins part of the unified collective", | ||
"license": "MIT", | ||
"keywords": [ | ||
"unified", | ||
"remark", | ||
"abstract", | ||
"ast", | ||
"compile", | ||
"markdown", | ||
"mdast", | ||
"abstract", | ||
"parse", | ||
"process", | ||
"remark", | ||
"serialize", | ||
"stringify", | ||
"syntax", | ||
"tree", | ||
"ast", | ||
"parse", | ||
"stringify", | ||
"serialize", | ||
"compile", | ||
"process" | ||
"unified" | ||
], | ||
@@ -34,4 +34,3 @@ "homepage": "https://remark.js.org", | ||
"type": "module", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"exports": "./index.js", | ||
"files": [ | ||
@@ -42,17 +41,27 @@ "index.d.ts", | ||
"dependencies": { | ||
"@types/mdast": "^3.0.0", | ||
"remark-parse": "^10.0.0", | ||
"remark-stringify": "^10.0.0", | ||
"unified": "^10.0.0" | ||
"@types/mdast": "^4.0.0", | ||
"remark-parse": "^11.0.0", | ||
"remark-stringify": "^11.0.0", | ||
"unified": "^11.0.0" | ||
}, | ||
"scripts": { | ||
"test": "node --conditions development test.js" | ||
}, | ||
"xo": false, | ||
"scripts": {}, | ||
"typeCoverage": { | ||
"atLeast": 100, | ||
"detail": true, | ||
"strict": true, | ||
"ignoreCatch": true | ||
"ignoreCatch": true, | ||
"strict": true | ||
}, | ||
"xo": { | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"**/*.ts" | ||
], | ||
"rules": { | ||
"@typescript-eslint/triple-slash-reference": "off" | ||
} | ||
} | ||
], | ||
"prettier": true | ||
} | ||
} |
216
readme.md
@@ -11,4 +11,4 @@ # remark | ||
**[unified][]** processor with support for parsing markdown input and | ||
serializing markdown as output. | ||
**[unified][]** processor with support for parsing from markdown and | ||
serializing to markdown. | ||
@@ -37,11 +37,7 @@ ## Contents | ||
This package is a [unified][] processor with support for parsing markdown input | ||
and serializing markdown as output by using unified with | ||
This package is a [unified][] processor with support for parsing markdown as | ||
input and serializing markdown as output by using unified with | ||
[`remark-parse`][remark-parse] and [`remark-stringify`][remark-stringify]. | ||
**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. | ||
Please see [the monorepo readme][remark] for what the remark ecosystem is. | ||
See [the monorepo readme][remark] for info on what the remark ecosystem is. | ||
@@ -56,3 +52,3 @@ ## When should I use this? | ||
output is not markdown (you don’t need `remark-stringify`), it’s recommended to | ||
use unified directly. | ||
use `unified` directly. | ||
@@ -64,4 +60,4 @@ When you want to inspect and format markdown files in a project on the command | ||
This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). | ||
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]: | ||
This package is [ESM only][esm]. | ||
In Node.js (version 16+), install with [npm][]: | ||
@@ -75,3 +71,3 @@ ```sh | ||
```js | ||
import {remark} from 'https://esm.sh/remark@14' | ||
import {remark} from 'https://esm.sh/remark@15' | ||
``` | ||
@@ -83,3 +79,3 @@ | ||
<script type="module"> | ||
import {remark} from 'https://esm.sh/remark@14?bundle' | ||
import {remark} from 'https://esm.sh/remark@15?bundle' | ||
</script> | ||
@@ -94,29 +90,69 @@ ``` | ||
import {remark} from 'remark' | ||
import remarkGfm from 'remark-gfm' | ||
import remarkToc from 'remark-toc' | ||
main() | ||
const doc = ` | ||
# Pluto | ||
async function main() { | ||
const file = await remark() | ||
.use(remarkGfm) | ||
.use(remarkToc) | ||
.process('# Hi\n\n## Table of contents\n\n## Hello\n\n*Some* ~more~ _things_.') | ||
Pluto is a dwarf planet in the Kuiper belt. | ||
console.error(String(file)) | ||
} | ||
## Contents | ||
## History | ||
### Discovery | ||
In the 1840s, Urbain Le Verrier used Newtonian mechanics to predict the position of… | ||
### Name and symbol | ||
The name Pluto is for the Roman god of the underworld, from a Greek epithet for Hades… | ||
### Planet X disproved | ||
Once Pluto was found, its faintness and lack of a viewable disc cast doubt… | ||
## Orbit | ||
Pluto's orbital period is about 248 years… | ||
` | ||
const file = await remark() | ||
.use(remarkToc, {heading: 'contents', tight: true}) | ||
.process(doc) | ||
console.error(String(file)) | ||
``` | ||
Running that with `node example.js` yields: | ||
…running that with `node example.js` yields: | ||
```markdown | ||
# Hi | ||
# Pluto | ||
## Table of contents | ||
Pluto is a dwarf planet in the Kuiper belt. | ||
* [Hello](#hello) | ||
## Contents | ||
## Hello | ||
* [History](#history) | ||
* [Discovery](#discovery) | ||
* [Name and symbol](#name-and-symbol) | ||
* [Planet X disproved](#planet-x-disproved) | ||
* [Orbit](#orbit) | ||
*Some* ~~more~~ *things*. | ||
## History | ||
### Discovery | ||
In the 1840s, Urbain Le Verrier used Newtonian mechanics to predict the position of… | ||
### Name and symbol | ||
The name Pluto is for the Roman god of the underworld, from a Greek epithet for Hades… | ||
### Planet X disproved | ||
Once Pluto was found, its faintness and lack of a viewable disc cast doubt… | ||
## Orbit | ||
Pluto's orbital period is about 248 years… | ||
``` | ||
@@ -126,3 +162,3 @@ | ||
This package exports the following identifier: `remark`. | ||
This package exports the identifier [`remark`][api-remark]. | ||
There is no default export. | ||
@@ -132,4 +168,6 @@ | ||
Create a new (unfrozen) unified processor that already uses `remark-parse` and | ||
`remark-stringify` and you can add more plugins to. | ||
Create a new unified processor that already uses | ||
[`remark-parse`][remark-parse] and [`remark-stringify`][remark-stringify]. | ||
You can add more plugins with `use`. | ||
See [`unified`][unified] for more information. | ||
@@ -145,17 +183,13 @@ | ||
```js | ||
import {reporter} from 'vfile-reporter' | ||
import {remark} from 'remark' | ||
import remarkPresetLintConsistent from 'remark-preset-lint-consistent' | ||
import remarkPresetLintRecommended from 'remark-preset-lint-recommended' | ||
import {reporter} from 'vfile-reporter' | ||
main() | ||
const file = await remark() | ||
.use(remarkPresetLintConsistent) | ||
.use(remarkPresetLintRecommended) | ||
.process('1) Hello, _Jupiter_ and *Neptune*!') | ||
async function main() { | ||
const file = await remark() | ||
.use(remarkPresetLintConsistent) | ||
.use(remarkPresetLintRecommended) | ||
.process('1) Hello, _Jupiter_ and *Neptune*!') | ||
console.error(reporter(file)) | ||
} | ||
console.error(reporter(file)) | ||
``` | ||
@@ -166,6 +200,6 @@ | ||
```txt | ||
1:1 warning Missing newline character at end of file final-newline remark-lint | ||
1:1-1:35 warning Marker style should be `.` ordered-list-marker-style remark-lint | ||
1:4 warning Incorrect list-item indent: add 1 space list-item-indent remark-lint | ||
1:25-1:34 warning Emphasis should use `_` as a marker emphasis-marker remark-lint | ||
warning Missing newline character at end of file final-newline remark-lint | ||
1:1-1:35 warning Marker style should be `.` ordered-list-marker-style remark-lint | ||
1:4 warning Incorrect list-item indent: add 1 space list-item-indent remark-lint | ||
1:25-1:34 warning Emphasis should use `_` as a marker emphasis-marker remark-lint | ||
@@ -185,11 +219,20 @@ ⚠ 4 warnings | ||
main() | ||
const doc = ` | ||
# Moons of Neptune | ||
async function main() { | ||
const file = await remark() | ||
.data('settings', {bullet: '*', setext: true, listItemIndent: 'one'}) | ||
.process('# Moons of Neptune\n\n- Naiad\n- Thalassa\n- Despine\n- …') | ||
1. Naiad | ||
2. Thalassa | ||
3. Despine | ||
4. … | ||
` | ||
console.log(String(file)) | ||
} | ||
const file = await remark() | ||
.data('settings', { | ||
bulletOrdered: ')', | ||
incrementListMarker: false, | ||
setext: true | ||
}) | ||
.process(doc) | ||
console.log(String(file)) | ||
``` | ||
@@ -203,6 +246,6 @@ | ||
* Naiad | ||
* Thalassa | ||
* Despine | ||
* … | ||
1) Naiad | ||
1) Thalassa | ||
1) Despine | ||
1) … | ||
``` | ||
@@ -217,3 +260,3 @@ | ||
The syntax tree format used in remark is [mdast][]. | ||
The syntax tree used in remark is [mdast][]. | ||
@@ -225,9 +268,25 @@ ## Types | ||
It also registers `Settings` with `unified`. | ||
If you’re passing options with `.data('settings', …)`, make sure to import this | ||
package somewhere in your types, as that registers the fields. | ||
```js | ||
/// <reference types="remark" /> | ||
import {unified} from 'unified' | ||
// @ts-expect-error: `thisDoesNotExist` is not a valid option. | ||
unified().data('settings', {thisDoesNotExist: false}) | ||
``` | ||
## Compatibility | ||
Projects maintained by the unified collective are compatible with all maintained | ||
Projects maintained by the unified collective are compatible with maintained | ||
versions of Node.js. | ||
As of now, that is Node.js 12.20+, 14.14+, and 16.0+. | ||
Our projects sometimes work with older versions, but this is not guaranteed. | ||
When we cut a new major release, we drop support for unmaintained versions of | ||
Node. | ||
This means we try to keep the current release line, `remark@^15`, compatible | ||
with Node.js 16. | ||
## Security | ||
@@ -237,4 +296,4 @@ | ||
[cross-site scripting (XSS)][xss] attacks, use of remark can be unsafe. | ||
When going to HTML, you will likely combine remark with **[rehype][]**, in which | ||
case you should use [`rehype-sanitize`][rehype-sanitize]. | ||
When going to HTML, you will combine remark with **[rehype][]**, in which case | ||
you should use [`rehype-sanitize`][rehype-sanitize]. | ||
@@ -261,4 +320,2 @@ Use of remark plugins could also open you up to other attacks. | ||
<!--lint ignore no-html--> | ||
<table> | ||
@@ -312,2 +369,6 @@ <tr valign="middle"> | ||
<td width="10%" align="center"> | ||
<a href="https://markdown.space">Markdown Space</a><br><br> | ||
<a href="https://markdown.space"><img src="https://images.opencollective.com/markdown-space/e1038ed/logo/128.png" width="64"></a> | ||
</td> | ||
<td width="10%" align="center"> | ||
<a href="https://www.holloway.com">Holloway</a><br><br> | ||
@@ -318,3 +379,2 @@ <a href="https://www.holloway.com"><img src="https://avatars1.githubusercontent.com/u/35904294?s=128&v=4" width="64"></a> | ||
<td width="10%"></td> | ||
<td width="10%"></td> | ||
</tr> | ||
@@ -348,5 +408,5 @@ <tr valign="middle"> | ||
[size-badge]: https://img.shields.io/bundlephobia/minzip/remark.svg | ||
[size-badge]: https://img.shields.io/bundlejs/size/remark | ||
[size]: https://bundlephobia.com/result?p=remark | ||
[size]: https://bundlejs.com/?q=remark | ||
@@ -379,18 +439,14 @@ [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg | ||
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c | ||
[esmsh]: https://esm.sh | ||
[unified]: https://github.com/unifiedjs/unified | ||
[mdast]: https://github.com/syntax-tree/mdast | ||
[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting | ||
[rehype]: https://github.com/rehypejs/rehype | ||
[typescript]: https://www.typescriptlang.org | ||
[rehype-sanitize]: https://github.com/rehypejs/rehype-sanitize | ||
[rehype]: https://github.com/rehypejs/rehype | ||
[remark]: https://github.com/remarkjs/remark | ||
[rehype-sanitize]: https://github.com/rehypejs/rehype-sanitize | ||
[remark-parse]: ../remark-parse | ||
@@ -401,1 +457,9 @@ | ||
[remark-cli]: ../remark-cli | ||
[typescript]: https://www.typescriptlang.org | ||
[unified]: https://github.com/unifiedjs/unified | ||
[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting | ||
[api-remark]: #remark-1 |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
15670
18
444
0
+ Added@types/mdast@4.0.4(transitive)
+ Added@types/unist@3.0.3(transitive)
+ Addeddevlop@1.1.0(transitive)
+ Addedmdast-util-from-markdown@2.0.2(transitive)
+ Addedmdast-util-phrasing@4.1.0(transitive)
+ Addedmdast-util-to-markdown@2.1.2(transitive)
+ Addedmdast-util-to-string@4.0.0(transitive)
+ Addedmicromark@4.0.0(transitive)
+ Addedmicromark-core-commonmark@2.0.1(transitive)
+ Addedmicromark-factory-destination@2.0.0(transitive)
+ Addedmicromark-factory-label@2.0.0(transitive)
+ Addedmicromark-factory-space@2.0.0(transitive)
+ Addedmicromark-factory-title@2.0.0(transitive)
+ Addedmicromark-factory-whitespace@2.0.0(transitive)
+ Addedmicromark-util-character@2.1.0(transitive)
+ Addedmicromark-util-chunked@2.0.0(transitive)
+ Addedmicromark-util-classify-character@2.0.0(transitive)
+ Addedmicromark-util-combine-extensions@2.0.0(transitive)
+ Addedmicromark-util-decode-numeric-character-reference@2.0.1(transitive)
+ Addedmicromark-util-decode-string@2.0.0(transitive)
+ Addedmicromark-util-encode@2.0.0(transitive)
+ Addedmicromark-util-html-tag-name@2.0.0(transitive)
+ Addedmicromark-util-normalize-identifier@2.0.0(transitive)
+ Addedmicromark-util-resolve-all@2.0.0(transitive)
+ Addedmicromark-util-sanitize-uri@2.0.0(transitive)
+ Addedmicromark-util-subtokenize@2.0.1(transitive)
+ Addedmicromark-util-symbol@2.0.0(transitive)
+ Addedmicromark-util-types@2.0.0(transitive)
+ Addedremark-parse@11.0.0(transitive)
+ Addedremark-stringify@11.0.0(transitive)
+ Addedunified@11.0.5(transitive)
+ Addedunist-util-is@6.0.0(transitive)
+ Addedunist-util-stringify-position@4.0.0(transitive)
+ Addedunist-util-visit@5.0.0(transitive)
+ Addedunist-util-visit-parents@6.0.1(transitive)
+ Addedvfile@6.0.3(transitive)
+ Addedvfile-message@4.0.2(transitive)
- Removed@types/mdast@3.0.15(transitive)
- Removed@types/unist@2.0.11(transitive)
- Removeddiff@5.2.0(transitive)
- Removedis-buffer@2.0.5(transitive)
- Removedkleur@4.1.5(transitive)
- Removedmdast-util-from-markdown@1.3.1(transitive)
- Removedmdast-util-phrasing@3.0.1(transitive)
- Removedmdast-util-to-markdown@1.5.0(transitive)
- Removedmdast-util-to-string@3.2.0(transitive)
- Removedmicromark@3.2.0(transitive)
- Removedmicromark-core-commonmark@1.1.0(transitive)
- Removedmicromark-factory-destination@1.1.0(transitive)
- Removedmicromark-factory-label@1.1.0(transitive)
- Removedmicromark-factory-space@1.1.0(transitive)
- Removedmicromark-factory-title@1.1.0(transitive)
- Removedmicromark-factory-whitespace@1.1.0(transitive)
- Removedmicromark-util-character@1.2.0(transitive)
- Removedmicromark-util-chunked@1.1.0(transitive)
- Removedmicromark-util-classify-character@1.1.0(transitive)
- Removedmicromark-util-combine-extensions@1.1.0(transitive)
- Removedmicromark-util-decode-numeric-character-reference@1.1.0(transitive)
- Removedmicromark-util-decode-string@1.1.0(transitive)
- Removedmicromark-util-encode@1.1.0(transitive)
- Removedmicromark-util-html-tag-name@1.2.0(transitive)
- Removedmicromark-util-normalize-identifier@1.1.0(transitive)
- Removedmicromark-util-resolve-all@1.1.0(transitive)
- Removedmicromark-util-sanitize-uri@1.2.0(transitive)
- Removedmicromark-util-subtokenize@1.1.0(transitive)
- Removedmicromark-util-symbol@1.1.0(transitive)
- Removedmicromark-util-types@1.1.0(transitive)
- Removedmri@1.2.0(transitive)
- Removedremark-parse@10.0.2(transitive)
- Removedremark-stringify@10.0.3(transitive)
- Removedsade@1.8.1(transitive)
- Removedunified@10.1.2(transitive)
- Removedunist-util-is@5.2.1(transitive)
- Removedunist-util-stringify-position@3.0.3(transitive)
- Removedunist-util-visit@4.1.2(transitive)
- Removedunist-util-visit-parents@5.1.3(transitive)
- Removeduvu@0.5.6(transitive)
- Removedvfile@5.3.7(transitive)
- Removedvfile-message@3.1.4(transitive)
Updated@types/mdast@^4.0.0
Updatedremark-parse@^11.0.0
Updatedremark-stringify@^11.0.0
Updatedunified@^11.0.0