Package Exports
- unified-prettier
Readme
unified-prettier
A prettier
serializer/stringifier for unified
ecosystem (rehype/remark/mdx)
TOC
Usage
Install
# pnpm
pnpm add unified-prettier
# yarn
yarn add unified-prettier
# npm
npm i unified-prettier
CLI
remark --use unified-prettier .
The above command may yield:
README.md
18:30-19:1 warning Replace `⏎` with `·` replace prettier
38:1 warning Insert `⏎` insert prettier
40:32-41:1 warning Delete `⏎` delete prettier
This can also be spcified in a .remarkrc
file:
{
"plugins": ["unified-prettier"]
}
API
This plugin can also be used with programmatically:
import { unified } from 'unified'
import { prettier } from 'unified-prettier'
import { readSync } from 'to-vfile'
unified()
.use(prettier, {
parser: 'markdown', // or `html`, or `mdx`,
// other `prettier` options
})
.process('# Hello World')
.then(({ messages, value }) => {
// Formatted content
console.log(value)
// Prettier formatting violations
console.dir(messages)
})
// or
unified()
.use(prettier, {
// no `parser` required if you're using correct `VFile#path`
// `prettier` options except parser
})
.process(readSync('README.md'))
.then(({ messages, value }) => {
// Formatted content
console.log(value)
// Prettier formatting violations
console.dir(messages)
})
Acknowledgements
Sponsors
1stG | RxTS | UnTS |
---|---|---|
Backers
1stG | RxTS | UnTS |
---|---|---|
Changelog
Detailed changes for each release are documented in CHANGELOG.md.