rehype-inline-css
TypeScript icon, indicating that this package has built-in type declarations

0.5.1 • Public • Published

Rehype Inline CSS

Rehype plugin to embed a stylesheet to each html elements.

Installation

npm install rehype-inline-css

Usage

import { unified } from 'unified'
import rehype from 'rehype-parse'
import stringify from 'rehype-stringify'
import inlineCss from './index.js'
const processor = unified().use(rehype).use(inlineCss).use(stringify)
const i = `<p>test</p><style>p { color: red; }</style>`
const o = processor.processSync(i).toString()
cosnole.log(o)

Now running the above script yields:

<p style="color: red;">test</p>

API

rehype().use(inlineCss)

Security

This plugin embeds all stylesheets in documents. Please take care of Suspicious stylesheets.

License

MIT © TANIGUCHI Masaya

https://git.io/mit-license

Readme

Keywords

none

Package Sidebar

Install

npm i rehype-inline-css

Weekly Downloads

10

Version

0.5.1

License

MIT

Unpacked Size

3.27 kB

Total Files

4

Last publish

Collaborators

  • taniguchi