Skip to content

Commit

Permalink
feat: add heading id generate feature for markdown block (#13)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Wang <[email protected]>
  • Loading branch information
ruibaby authored Feb 5, 2024
1 parent a804ac2 commit a2430b2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@halo-dev/console-shared": "^2.7.0",
"@lezer/highlight": "1.1.6",
"marked": "^9.1.2",
"marked-gfm-heading-id": "^3.1.2",
"turndown": "^7.1.2",
"turndown-plugin-gfm": "^1.0.2",
"vue": "^3.3.4"
Expand Down
16 changes: 16 additions & 0 deletions console/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion console/src/editor/markdown-edited.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { markRaw } from "vue";
import MdiLanguageMarkdown from "~icons/mdi/language-markdown";
import { CodeMirrorView } from "./code-mirror-view";
import { markdown } from "@codemirror/lang-markdown";
import { marked } from "marked";
import marked from "@/utils/markdown";
import TurndownService from "turndown";
import { gfm } from "turndown-plugin-gfm";
import { ToolboxItem } from "@halo-dev/richtext-editor";
Expand Down
6 changes: 6 additions & 0 deletions console/src/utils/markdown.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { marked } from "marked";
import { gfmHeadingId } from "marked-gfm-heading-id";

marked.use(gfmHeadingId());

export default marked;

0 comments on commit a2430b2

Please sign in to comment.