MCPcopy Index your code
hub / github.com/markmap/markmap / _buildHtml

Method _buildHtml

packages/markmap-cli/src/util/dev-server.ts:166–197  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

164 }
165
166 private _buildHtml() {
167 const otherAssets = mergeAssets(
168 this.options.toolbar ? toolbarAssets : null,
169 {
170 scripts: [
171 {
172 type: 'iife',
173 data: {
174 fn: (options) => {
175 window.markmap.cliOptions = options;
176 },
177 getParams: () => [this.options],
178 },
179 },
180 ],
181 },
182 );
183 const assets = mergeAssets(this.transformer.getAssets(), {
184 scripts: otherAssets.scripts?.map((item) =>
185 this.transformer.resolveJS(item),
186 ),
187 styles: otherAssets.styles?.map((item) =>
188 this.transformer.resolveCSS(item),
189 ),
190 });
191 // Note: `client.js` must be loaded after `mm` is ready
192 const html =
193 fillTemplate(null, assets, {
194 urlBuilder: this.transformer.urlBuilder,
195 }) + '<script src="/~client.js"></script>';
196 return html;
197 }
198
199 async setup() {
200 if (this.serverInfo) throw new Error('Server already set up');

Callers 1

constructorMethod · 0.95

Calls 5

mergeAssetsFunction · 0.90
fillTemplateFunction · 0.90
getAssetsMethod · 0.80
resolveJSMethod · 0.80
resolveCSSMethod · 0.80

Tested by

no test coverage detected