Skip to content

Commit

Permalink
chore: 🤖 types
Browse files Browse the repository at this point in the history
  • Loading branch information
huyikai committed Feb 21, 2024
1 parent b608b3b commit 88c9d9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/@huyikai/local-cms/cms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@nolebase/markdown-it-element-transform": "^1.20.1",
"@rushstack/eslint-patch": "^1.1.4",
"@types/jsdom": "^20.0.1",
"@types/markdown-it": "^13.0.7",
"@types/markdown-it-anchor": "^7.0.0",
"@types/markdown-it-attrs": "^4.1.3",
"@types/markdown-it-container": "^2.0.9",
Expand Down
8 changes: 5 additions & 3 deletions packages/@huyikai/local-cms/cms/src/views/Editor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,12 @@ const createMarkdownItInstance = async () => {
slugify,
permalink: anchorPlugin.permalink.linkInsideHeader({
symbol: '​',
renderAttrs: (slug: any, state: any) => {
const idx = state.tokens.findIndex((token: any) => {
renderAttrs: (slug: string, state: any) => {
const idx = state.tokens.findIndex((token: MarkdownIt.Token) => {
const attrs = token.attrs;
const id = attrs?.find((attr: any) => attr[0] === 'id');
const id = attrs?.find(
(attr: [string, string]) => attr[0] === 'id'
);
return id && slug === id[1];
});
const title = state.tokens[idx + 1].content;
Expand Down

0 comments on commit 88c9d9c

Please sign in to comment.