0.0.2 • Published 10 months ago

unified-conditional v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

unified-conditional

Apply unified plugins conditionally

Usage

import { remark } from 'remark'
import { VFile } from 'vfile'
import { unifiedConditional } from 'unified-conditional'

let options = [
  // Pattern to match
  /example\.md$/,
  // Plugins to run if pattern matches
  [/* ... */],
  // Plugins to run if pattern does not match
  [/* ... */],
]

await remark()
  .use(unifiedConditional, options)
  .process(new VFile({ path: '/example.md', value: '# Hello world' }))

The pattern can be one of three types:

  • string: String value to match the filename against exactly
  • RegExp: Regular expression to test the filename against
  • function: Custom match function which receives the transformer arguments and returns a boolean value
0.0.2

10 months ago

0.0.1

10 months ago