(transformHooks: ITransformHooks)
| 8 | name, |
| 9 | config, |
| 10 | transform(transformHooks: ITransformHooks) { |
| 11 | let enableFeature = noop; |
| 12 | transformHooks.parser.tap((md) => { |
| 13 | md.use(katexPlugin); |
| 14 | ['math_block', 'math_inline'].forEach((key) => { |
| 15 | const fn = md.renderer.rules[key]; |
| 16 | if (fn) { |
| 17 | md.renderer.rules[key] = wrapFunction(fn, (render, ...args) => { |
| 18 | enableFeature(); |
| 19 | return render(...args); |
| 20 | }); |
| 21 | } |
| 22 | }); |
| 23 | }); |
| 24 | transformHooks.beforeParse.tap((_, context) => { |
| 25 | enableFeature = () => { |
| 26 | context.features[name] = true; |
| 27 | }; |
| 28 | }); |
| 29 | return { |
| 30 | styles: plugin.config?.styles, |
| 31 | scripts: plugin.config?.scripts, |
| 32 | }; |
| 33 | }, |
| 34 | }); |
| 35 | |
| 36 | export default plugin; |
nothing calls this directly
no test coverage detected