mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-26 21:36:23 +00:00
31 lines
686 B
TypeScript
31 lines
686 B
TypeScript
|
import { PluggableList } from "unified"
|
||
|
import remarkGfm from "remark-gfm"
|
||
|
import smartypants from 'remark-smartypants'
|
||
|
import { QuartzTransformerPlugin } from "../types"
|
||
|
|
||
|
export interface Options {
|
||
|
enableSmartyPants: boolean
|
||
|
}
|
||
|
|
||
|
const defaultOptions: Options = {
|
||
|
enableSmartyPants: true
|
||
|
}
|
||
|
|
||
|
export class GitHubFlavoredMarkdown extends QuartzTransformerPlugin {
|
||
|
name = "GitHubFlavoredMarkdown"
|
||
|
opts: Options
|
||
|
|
||
|
constructor(opts?: Options) {
|
||
|
super()
|
||
|
this.opts = { ...defaultOptions, ...opts }
|
||
|
}
|
||
|
|
||
|
markdownPlugins(): PluggableList {
|
||
|
return this.opts.enableSmartyPants ? [remarkGfm] : [remarkGfm, smartypants]
|
||
|
}
|
||
|
|
||
|
htmlPlugins(): PluggableList {
|
||
|
return []
|
||
|
}
|
||
|
}
|