| 67 | export const ready = initialize(); |
| 68 | |
| 69 | function transform(transformer: Transformer, content: string) { |
| 70 | const result = transformer.transform(content); |
| 71 | const keys = Object.keys(result.features).filter((key) => !enabled[key]); |
| 72 | keys.forEach((key) => { |
| 73 | enabled[key] = true; |
| 74 | }); |
| 75 | const { styles, scripts } = transformer.getAssets(keys); |
| 76 | const { markmap } = window; |
| 77 | if (styles) markmap.loadCSS(styles); |
| 78 | if (scripts) markmap.loadJS(scripts); |
| 79 | return result; |
| 80 | } |
| 81 | |
| 82 | export function render(el: HTMLElement) { |
| 83 | const { Transformer, Markmap, deriveOptions, Toolbar } = window.markmap; |