New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rehype-document

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rehype-document - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

15

package.json
{
"name": "rehype-document",
"version": "2.0.0",
"version": "2.0.1",
"description": "Wrap a document around the syntax tree",

@@ -31,8 +31,8 @@ "license": "MIT",

"esmangle": "^1.0.1",
"nyc": "^10.0.0",
"rehype": "^4.0.0",
"nyc": "^11.0.0",
"rehype": "^5.0.0",
"remark-cli": "^3.0.0",
"remark-preset-wooorm": "^2.0.0",
"remark-preset-wooorm": "^3.0.0",
"tape": "^4.0.0",
"xo": "^0.17.1"
"xo": "^0.18.0"
},

@@ -57,2 +57,3 @@ "scripts": {

"space": true,
"esnext": false,
"ignores": [

@@ -63,4 +64,6 @@ "rehype-document.js"

"remarkConfig": {
"plugins": ["preset-wooorm"]
"plugins": [
"preset-wooorm"
]
}
}

88

readme.md

@@ -15,33 +15,36 @@ # rehype-document [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov]

Say `example.md` looks as follows:
```markdown
## Hello world!
This is **my** document.
```
...and `example.js` like this:
```javascript
var vfile = require('to-vfile');
var report = require('vfile-reporter');
var unified = require('unified');
var createStream = require('unified-stream');
var parse = require('remark-parse');
var mutate = require('remark-rehype');
var stringify = require('rehype-stringify');
var document = require('rehype-document');
var doc = require('rehype-document');
var processor = unified()
unified()
.use(parse)
.use(mutate)
.use(document, {title: 'Hi!'})
.use(stringify);
process.stdin
.pipe(createStream(processor))
.pipe(process.stdout)
.on('error', console.error);
.use(doc, {title: 'Hi!'})
.use(stringify)
.process(vfile.readSync('example.md'), function (err, file) {
console.error(report(err || file));
console.log(String(file));
});
```
When the following is given on **stdin**(4):
Now, running `node example` yields:
```markdown
## Hello world!
This is **my** document.
```
Yields the following on **stdout**(4):
```html
example.md: no issues found
<!DOCTYPE html>

@@ -65,17 +68,38 @@ <html lang="en">

###### `options`
Wrap a document around a fragment.
* `title` (`string`, default: name of file, if any)
— Text to use as title;
* `language` (`string`, default: `'en'`)
— Natural language of document (BCP 47);
* `responsive` (`boolean`, default: `true`)
— Whether to insert a `meta[viewport]`;
* `doctype` (`string`, default: `'5'`)
— [Doctype][doctype] to use;
* `css` (`string` or `Array.<string>`, default: `[]`)
— Stylesheets to include in `head`;
* `js` (`string` or `Array.<string>`, default: `[]`)
— Scripts to include at end of `body`.
##### `options`
###### `options.title`
`string`, default: name of file, if any — Text to use as title.
###### `options.language`
`string`, default: `'en'` — Natural language of document (BCP 47).
###### `options.responsive`
`boolean`, default: `true` — Whether to insert a `meta[viewport]`.
###### `options.doctype`
`string`, default: `'5'` — [Doctype][doctype] to use.
###### `options.css`
`string` or `Array.<string>`, default: `[]` — Stylesheets to include in `head`.
###### `options.js`
`string` or `Array.<string>`, default: `[]` — Scripts to include at end of
`body`.
## Related
* [`rehype-format`](https://github.com/wooorm/rehype-format)
— Format HTML
* [`rehype-minify`](https://github.com/wooorm/rehype-minify)
— Minify HTML
## License

@@ -82,0 +106,0 @@

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