Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remark

Package Overview
Dependencies
Maintainers
2
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark - npm Package Compare versions

Comparing version 14.0.3 to 15.0.0

17

index.d.ts

@@ -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
}
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc