vite-plugin-unified-compiler
v0.0.3
Published
Vite plugin that compiles files using unified.js.
Downloads
4
Maintainers
Readme
vite-plugin-unified-compiler
Complie raw file using unified.js.
Usage
// vite.config.js / vite.config.ts
import { unifiedPlugin } from 'vite-plugin-unified-compiler'
export default {
plugins: [
unifiedPlugin() // default behavior is to compile all md file to html document.
]
}
Config
fileRegex: a RegExp object of file name
processor: an unified processor like unified().use(remarkParse).use(remarkRehype).use(rehypeStringify)
// vite.config.js / vite.config.ts
import { unifiedPlugin } from 'vite-plugin-unified-compiler'
import rehypeStringify from 'rehype-stringify'
import remarkParse from 'remark-parse'
import remarkRehype from 'remark-rehype'
import {unified} from 'unified'
const customProcessor = unified().use(remarkParse).use(remarkRehype).use(rehypeStringify)
export default {
plugins: [
unifiedPlugin({fileRegex: new Regex(/.*?.md\?raw/)}),
processor: customProcessor
]
}