refactor(markdown): Make module CLI-importable
Drop the mermaid import from the markdown module. The extension only emits <pre class="mermaid">, so initialize mermaid in the app entry instead. Use explicit .js specifiers plus a bundler extensionAlias so both the NodeNext CLI build and the web build resolve the sources.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { MarkedExtension } from "marked";
|
||||
import yaml from "js-yaml";
|
||||
import { parseBlockAttrs } from "./block-attrs";
|
||||
import { parseBlockAttrs } from "./block-attrs.js";
|
||||
|
||||
/**
|
||||
* YAML-defined tag blocks:
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Marked, type MarkedExtension } from "marked";
|
||||
import { createDirectives, presetDirectiveConfigs } from "marked-directive";
|
||||
import markedAlert from "marked-alert";
|
||||
import markedMermaid from "./mermaid";
|
||||
import markedMermaid from "./mermaid.js";
|
||||
import { gfmHeadingId } from "marked-gfm-heading-id";
|
||||
import markedColumns from "./columns";
|
||||
import markedCodeBlockYamlTag from "./code-block-yaml-tag";
|
||||
import { iconDirective, setIconBase } from "./icon";
|
||||
import { cmdDirective } from "./cmd";
|
||||
import markedColumns from "./columns.js";
|
||||
import markedCodeBlockYamlTag from "./code-block-yaml-tag.js";
|
||||
import { iconDirective, setIconBase } from "./icon.js";
|
||||
import { cmdDirective } from "./cmd.js";
|
||||
|
||||
// 使用 marked-directive 来支持指令语法
|
||||
const marked = new Marked()
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import type {MarkedExtension} from "marked";
|
||||
import mermaid from "mermaid";
|
||||
|
||||
mermaid.initialize({
|
||||
theme: 'dark'
|
||||
});
|
||||
|
||||
export default function markedMermaid(): MarkedExtension {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user