Skip to content

Commit 15b754a

Browse files
committed
fix: initialize plugins
1 parent 5732b81 commit 15b754a

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

src/plugins/mathjax.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ export const scripts: JSItem[] = [
1010
skipHtmlTags: { '[-]': ['code', 'pre'] },
1111
...mathJax.options,
1212
};
13+
mathJax.startup = {
14+
typeset: false,
15+
...mathJax.startup,
16+
};
1317
(window as any).MathJax = mathJax;
1418
},
1519
getParams: context => [{ ...context.mathJax }],

src/template.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ export function fillTemplate(data: any, opts?: any): string {
2727
type: 'iife',
2828
data: {
2929
fn: (data, ...processors) => {
30-
const { markmap } = window as any;
30+
const { markmap } = (window as any).markmap;
3131
markmap.processors = processors;
32-
markmap.markmap('svg#mindmap', data);
32+
markmap('svg#mindmap', data);
3333
},
3434
getParams: ({ data, processors }) => [
3535
data,

src/util/html.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function escapeScript(content: string): string {
1010
return content.replace(/<(\/script>)/g, '\\x3c$2');
1111
}
1212

13-
export function htmlOpen(tagName: string, attrs?: any, autoClose = false): string {
13+
export function htmlOpen(tagName: string, attrs?: any): string {
1414
const attrStr = attrs ? Object.entries<string | boolean>(attrs)
1515
.map(([key, value]) => {
1616
if (value == null || value === false) return;
@@ -28,7 +28,7 @@ export function htmlClose(tagName: string): string {
2828
}
2929

3030
export function wrapHtml(tagName: string, content?: string, attrs?: any): string {
31-
if (content == null) return htmlOpen(tagName, attrs, true);
31+
if (content == null) return htmlOpen(tagName, attrs);
3232
return htmlOpen(tagName, attrs) + (content || '') + htmlClose(tagName);
3333
}
3434

src/view.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,16 @@ function markmapCreate(svg: any, data?: any, opts?: IMarkmapOptions) {
9191
};
9292
const g = svg.append('g').attr('class', `${state.id}-g`);
9393
updateStyle();
94-
if (data) {
95-
setData(data);
96-
fit(); // always fit for the first render
97-
}
9894
svg.call(zoom);
9995
const mm = {
10096
setData,
10197
setOptions,
10298
fit,
10399
};
100+
if (data) {
101+
setData(data);
102+
fit(); // always fit for the first render
103+
}
104104
return mm;
105105

106106
function getStyleContent(): string {

0 commit comments

Comments
 (0)