| | |
| | | return s.substring(0, 1).toUpperCase() + s.substring(1); |
| | | } |
| | | |
| | | export class ObsidianFlavoredMarkdown extends QuartzTransformerPlugin { |
| | | name = "ObsidianFlavoredMarkdown" |
| | | opts: Options |
| | | |
| | | constructor(opts?: Partial<Options>) { |
| | | super() |
| | | this.opts = { ...defaultOptions, ...opts } |
| | | } |
| | | |
| | | markdownPlugins(): PluggableList { |
| | | export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options> | undefined> = (userOpts) => { |
| | | const opts = { ...defaultOptions, ...userOpts } |
| | | return { |
| | | name: "ObsidianFlavoredMarkdown", |
| | | markdownPlugins() { |
| | | const plugins: PluggableList = [] |
| | | |
| | | if (this.opts.wikilinks) { |
| | | if (opts.wikilinks) { |
| | | plugins.push(() => { |
| | | // Match wikilinks |
| | | // !? -> optional embedding |
| | |
| | | ) |
| | | } |
| | | |
| | | if (this.opts.highlight) { |
| | | if (opts.highlight) { |
| | | plugins.push(() => { |
| | | // Match highlights |
| | | const highlightRegex = new RegExp(/==(.+)==/, "g") |
| | |
| | | }) |
| | | } |
| | | |
| | | if (this.opts.callouts) { |
| | | if (opts.callouts) { |
| | | plugins.push(() => { |
| | | // from https://github.com/escwxyz/remark-obsidian-callout/blob/main/src/index.ts |
| | | const calloutRegex = new RegExp(/^\[\!(\w+)\]([+-]?)/) |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | return plugins |
| | | } |
| | | }, |
| | | |
| | | htmlPlugins(): PluggableList { |
| | | htmlPlugins() { |
| | | return [rehypeRaw] |
| | | } |
| | | } |
| | | } |