MCPcopy
hub / github.com/markmap/markmap / constructor

Method constructor

packages/markmap-lib/src/transform.ts:46–65  ·  view source on GitHub ↗
(
    plugins: Array<
      ITransformPlugin | (() => ITransformPlugin)
    > = builtInPlugins,
  )

Source from the content-addressed store, hash-verified

44 plugins: ITransformPlugin[];
45
46 constructor(
47 plugins: Array<
48 ITransformPlugin | (() => ITransformPlugin)
49 > = builtInPlugins,
50 ) {
51 this.hooks = createTransformHooks(this);
52 this.plugins = plugins.map((plugin) =>
53 typeof plugin === 'function' ? plugin() : plugin,
54 );
55
56 const assetsMap: typeof this.assetsMap = {};
57 for (const { name, transform } of this.plugins) {
58 assetsMap[name] = transform(this.hooks);
59 }
60 this.assetsMap = assetsMap;
61
62 const md = initializeMarkdownIt();
63 this.md = md;
64 this.hooks.parser.call(md);
65 }
66
67 transform(
68 content: string,

Callers

nothing calls this directly

Calls 4

createTransformHooksFunction · 0.90
initializeMarkdownItFunction · 0.90
callMethod · 0.80
transformFunction · 0.50

Tested by

no test coverage detected