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

rehype-partials

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rehype-partials

Partials support for rehype

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15
decreased by-94.23%
Maintainers
1
Weekly downloads
 
Created
Source

rehype-partials

Build Status Coverage Status

Partials support for rehype.

Usage

With the following html,

index.html
<div class='container'>
  <!-- href='include/hello.html' -->
</div>
./include/hello.html
<div class='hello'>
  <!-- href='world.html' -->
</div>
./include/world.html
<div class='world'>
  <p>world</p>
</div>

and the following js,

index.js
var reporter = require('vfile-reporter')
var format = require('rehype-format')
var vfile = require('to-vfile')
var rehype = require('rehype')
var partials = require('rehype-partials')

rehype()
  .use(partials)
  .use(format)
  .process(toVfile.readSync('./index.html'), function (err, file) {
    console.error(reporter(err || file))
    console.log(String(file))
  })

will output:

./index.html: no issues found
<html>
  <head></head>
  <body>
    <div class="container">
      <div class="hello">
        <div class="world">
          <p>world</p>
        </div>
      </div>
    </div>
  </body>
</html>

Options

options.handle

Type: function

Default: fs.readFile

Function used to get a partial. example

options.cwd

Type: String

Default: ''

Set the current working directory to resolve a partial's path.

options.noresolve

Type: Boolean

Default: false

Whether or not to use path.resolve when looking for a partial.

options.messages

Type: Boolean

Default: true

Whether to include messages generated when parsing a partial.

License

MIT © Paul Zimmer

Keywords

FAQs

Package last updated on 03 Apr 2020

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