Socket
Socket
Sign inDemoInstall

remark-parse

Package Overview
Dependencies
46
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 9.0.0 to 10.0.0

index.d.ts

25

index.js

@@ -1,24 +0,3 @@

'use strict'
import remarkParse from './lib/index.js'
module.exports = parse
var fromMarkdown = require('mdast-util-from-markdown')
function parse(options) {
var self = this
this.Parser = parse
function parse(doc) {
return fromMarkdown(
doc,
Object.assign({}, self.data('settings'), options, {
// Note: these options are not in the readme.
// The goal is for them to be set by plugins on `data` instead of being
// passed by users.
extensions: self.data('micromarkExtensions') || [],
mdastExtensions: self.data('fromMarkdownExtensions') || []
})
)
}
}
export default remarkParse
{
"name": "remark-parse",
"version": "9.0.0",
"description": "remark plugin to parse Markdown",
"version": "10.0.0",
"description": "remark plugin to parse markdown",
"license": "MIT",

@@ -19,3 +19,2 @@ "keywords": [

],
"types": "types/index.d.ts",
"homepage": "https://remark.js.org",

@@ -36,13 +35,27 @@ "repository": "https://github.com/remarkjs/remark/tree/main/packages/remark-parse",

],
"sideEffects": false,
"type": "module",
"main": "index.js",
"types": "index.d.ts",
"files": [
"index.js",
"types/index.d.ts"
"lib/",
"index.d.ts",
"index.js"
],
"dependencies": {
"mdast-util-from-markdown": "^0.8.0"
"@types/mdast": "^3.0.0",
"mdast-util-from-markdown": "^1.0.0",
"unified": "^10.0.0"
},
"scripts": {
"test": "tape test.js"
"test": "node --conditions development test.js",
"build": "rimraf \"test.d.ts\" \"lib/**/*.d.ts\" && tsc && type-coverage"
},
"xo": false
"xo": false,
"typeCoverage": {
"atLeast": 100,
"detail": true,
"strict": true,
"ignoreCatch": true
}
}

@@ -12,10 +12,13 @@ # remark-parse

[Parser][] for [**unified**][unified].
Parses Markdown to [**mdast**][mdast] syntax trees.
Parses markdown to [**mdast**][mdast] syntax trees.
Built on [`micromark`][micromark] and
[`mdast-util-from-markdown`][from-markdown].
Used in the [**remark** processor][remark] but can be used on its own as well.
Can be [extended][extend] to change how Markdown is parsed.
Can be [extended][extend] to change how markdown is parsed.
## Install
This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c):
Node 12+ is needed to use it and it must be `import`ed instead of `require`d.
[npm][]:

@@ -30,11 +33,24 @@

```js
var unified = require('unified')
var createStream = require('unified-stream')
var markdown = require('remark-parse')
var remark2rehype = require('remark-rehype')
var html = require('rehype-stringify')
import {unified} from 'unified'
import remarkParse from 'remark-parse'
import remarkGfm from 'remark-gfm'
import remarkRehype from 'remark-rehype'
import rehypeStringify from 'rehype-stringify'
var processor = unified().use(markdown).use(remark2rehype).use(html)
unified()
.use(remarkParse)
.use(remarkGfm)
.use(remarkRehype)
.use(rehypeStringify)
.process('# Hi\n\n*Hello*, world!')
.then((file) => {
console.log(String(file))
})
```
process.stdin.pipe(createStream(processor)).pipe(process.stdout)
Yields:
```html
<h1>Hi</h1>
<p><em>Hello</em>, world!</p>
```

@@ -48,5 +64,8 @@

### `processor().use(parse)`
This package exports no identifiers.
The default export is `remarkParse`.
Configure the `processor` to read Markdown as input and process
### `unified().use(remarkParse)`
Configure the `processor` to read markdown as input and process
[**mdast**][mdast] syntax trees.

@@ -61,3 +80,3 @@

As Markdown is sometimes used for HTML, and improper use of HTML can open you up
As markdown is sometimes used for HTML, and improper use of HTML can open you up
to a [cross-site scripting (XSS)][xss] attack, use of remark can also be unsafe.

@@ -137,5 +156,5 @@ When going to HTML, use remark in combination with the [**rehype**][rehype]

[build-badge]: https://img.shields.io/travis/remarkjs/remark.svg
[build-badge]: https://github.com/remarkjs/remark/workflows/main/badge.svg
[build]: https://travis-ci.org/remarkjs/remark
[build]: https://github.com/remarkjs/remark/actions

@@ -142,0 +161,0 @@ [coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark.svg

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc