@milkdown/plugin-diagram
Advanced tools
Comparing version 7.3.1 to 7.3.2
import type { Meta, MilkdownPlugin } from '@milkdown/ctx'; | ||
export declare const withMeta: <T extends MilkdownPlugin>(plugin: T, meta: Partial<Meta> & Pick<Meta, 'displayName'>) => T; | ||
export declare function withMeta<T extends MilkdownPlugin>(plugin: T, meta: Partial<Meta> & Pick<Meta, 'displayName'>): T; | ||
//# sourceMappingURL=with-meta.d.ts.map |
@@ -8,12 +8,18 @@ import { expectDomTypeError as f } from "@milkdown/exception"; | ||
import { customAlphabet as R } from "nanoid"; | ||
const $ = (t) => ({ | ||
type: "diagram", | ||
value: t | ||
}), w = (t) => M(t, "code", (e, i, a) => { | ||
const { lang: r, value: s } = e; | ||
if (r !== "mermaid") | ||
return e; | ||
const m = $(s); | ||
return a && i != null && a.children.splice(i, 1, m), e; | ||
}), I = () => { | ||
function $(t) { | ||
return { | ||
type: "diagram", | ||
value: t | ||
}; | ||
} | ||
function w(t) { | ||
return M(t, "code", (e, i, a) => { | ||
const { lang: r, value: s } = e; | ||
if (r !== "mermaid") | ||
return e; | ||
const m = $(s); | ||
return a && i != null && a.children.splice(i, 1, m), e; | ||
}); | ||
} | ||
function I() { | ||
function t(e) { | ||
@@ -23,11 +29,16 @@ w(e); | ||
return t; | ||
}, T = R("abcdefg", 8), c = (t) => { | ||
} | ||
const T = R("abcdefg", 8), c = (t) => { | ||
var e; | ||
return ((e = t == null ? void 0 : t.attrs) == null ? void 0 : e.identity) || T(); | ||
}, n = (t, e) => (Object.assign(t, { | ||
meta: { | ||
package: "@milkdown/plugin-diagram", | ||
...e | ||
} | ||
}), t), l = k({ startOnLoad: !1 }, "mermaidConfig"); | ||
}; | ||
function n(t, e) { | ||
return Object.assign(t, { | ||
meta: { | ||
package: "@milkdown/plugin-diagram", | ||
...e | ||
} | ||
}), t; | ||
} | ||
const l = k({ startOnLoad: !1 }, "mermaidConfig"); | ||
n(l, { | ||
@@ -34,0 +45,0 @@ displayName: "Ctx<mermaidConfig>" |
import type { Node } from '@milkdown/transformer'; | ||
export declare const remarkMermaid: () => (tree: Node) => void; | ||
export declare function remarkMermaid(): (tree: Node) => void; | ||
//# sourceMappingURL=remark-mermaid.d.ts.map |
{ | ||
"name": "@milkdown/plugin-diagram", | ||
"type": "module", | ||
"version": "7.3.1", | ||
"version": "7.3.2", | ||
"license": "MIT", | ||
@@ -36,11 +36,11 @@ "repository": { | ||
"unist-util-visit": "^5.0.0", | ||
"@milkdown/exception": "7.3.1", | ||
"@milkdown/utils": "7.3.1" | ||
"@milkdown/exception": "7.3.2", | ||
"@milkdown/utils": "7.3.2" | ||
}, | ||
"devDependencies": { | ||
"@types/d3": "^7.4.0", | ||
"@milkdown/core": "7.3.1", | ||
"@milkdown/ctx": "7.3.1", | ||
"@milkdown/prose": "7.3.1", | ||
"@milkdown/transformer": "7.3.1" | ||
"@milkdown/core": "7.3.2", | ||
"@milkdown/ctx": "7.3.2", | ||
"@milkdown/prose": "7.3.2", | ||
"@milkdown/transformer": "7.3.2" | ||
}, | ||
@@ -47,0 +47,0 @@ "nx": { |
/* Copyright 2021, Milkdown by Mirone. */ | ||
import type { Meta, MilkdownPlugin } from '@milkdown/ctx' | ||
export const withMeta = <T extends MilkdownPlugin>( | ||
plugin: T, | ||
meta: Partial<Meta> & Pick<Meta, 'displayName'>, | ||
): T => { | ||
export function withMeta<T extends MilkdownPlugin>(plugin: T, meta: Partial<Meta> & Pick<Meta, 'displayName'>): T { | ||
Object.assign(plugin, { | ||
@@ -9,0 +6,0 @@ meta: { |
@@ -6,9 +6,11 @@ /* Copyright 2021, Milkdown by Mirone. */ | ||
const createMermaidDiv = (contents: string) => ({ | ||
type: 'diagram', | ||
value: contents, | ||
}) | ||
function createMermaidDiv(contents: string) { | ||
return { | ||
type: 'diagram', | ||
value: contents, | ||
} | ||
} | ||
const visitCodeBlock = (ast: Node) => | ||
visit(ast, 'code', (node, index, parent: Node & { children: Node[] }) => { | ||
function visitCodeBlock(ast: Node) { | ||
return visit(ast, 'code', (node, index, parent: Node & { children: Node[] }) => { | ||
const { lang, value } = node | ||
@@ -27,4 +29,5 @@ | ||
}) | ||
} | ||
export const remarkMermaid = () => { | ||
export function remarkMermaid() { | ||
function transformer(tree: Node) { | ||
@@ -31,0 +34,0 @@ visitCodeBlock(tree) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
23836
306
+ Added@milkdown/exception@7.3.2(transitive)
+ Added@milkdown/utils@7.3.2(transitive)
- Removed@milkdown/exception@7.3.1(transitive)
- Removed@milkdown/utils@7.3.1(transitive)
Updated@milkdown/exception@7.3.2
Updated@milkdown/utils@7.3.2