https://github.com/tani/rehype-inline-css
https://github.com/tani/rehype-inline-css
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tani/rehype-inline-css
- Owner: tani
- Created: 2021-09-10T05:01:02.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T17:54:44.000Z (over 1 year ago)
- Last Synced: 2025-03-28T01:56:37.933Z (2 months ago)
- Language: TypeScript
- Size: 122 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rehype Inline CSS
Rehype plugin to embed a stylesheet to each html elements.
## Installation
npm install rehype-inline-css
## Usage
```js
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 = `test
p { color: red; }`
const o = processor.processSync(i).toString()
cosnole.log(o)
```Now running the above script yields:
```html
test
```## 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