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

Wrap a document around the syntax tree

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.7K
decreased by-38.06%
Maintainers
1
Weekly downloads
 
Created
Source

rehype-document Build Status Coverage Status

Wrap a document around HTML with rehype.

Installation

npm:

npm install rehype-document

Usage

var unified = require('unified');
var parse = require('remark-parse');
var mutate = require('remark-rehype');
var stringify = require('rehype-stringify');
var document = require('rehype-document');

process.stdin
    .pipe(unified())
    .use(parse)
    .use(mutate)
    .use(document, {title: 'Hi!'})
    .use(stringify)
    .on('error', console.log)
    .pipe(process.stdout);

When the following is given on stdin(4):

## Hello world!

This is **my** document.

Yields the following on stdout(4):

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hi!</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h2>Hello world!</h2>
<p>This is <strong>my</strong> document.</p>
</body>
</html>

API

rehype.use(document[, options])

options
  • 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 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.

License

MIT © Titus Wormer

Keywords

FAQs

Package last updated on 19 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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