0.0.3 • Published 1 year ago

vite-plugin-unified-compiler v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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
  ]
}
0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago