generated from canisminor1990/canisminor-template
-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: Update dependencies and modify code in TypeScript files
- Update dependencies in package.json - Add new dependencies to package.json - Modify code in remarklint/index.ts, remarklint/remarkGfmHighlight.ts, and remarklint/remarkTextrPlugins.ts files The changes were made to update dependencies and add new dependencies in the package.json file. Additionally, code modifications were done in the remarklint/index.ts, remarklint/remarkGfmHighlight.ts, and remarklint/remarkTextrPlugins.ts files.
- Loading branch information
1 parent
5252afb
commit 0786757
Showing
4 changed files
with
44 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const gfmHighlight = [ | ||
{ from: 'Note', to: '[!NOTE]' }, | ||
{ from: 'Tip', to: '[!TIP]' }, | ||
{ from: 'Important', to: '[!IMPORTANT]' }, | ||
{ from: 'Warning', to: '[!WARNING]' }, | ||
{ from: 'Caution', to: '[!CAUTION]' }, | ||
]; | ||
|
||
export function remarkGfmHighlight() { | ||
return async (tree: any) => { | ||
const { visit } = await import('unist-util-visit'); | ||
visit(tree, 'blockquote', (node: any) => { | ||
visit(node, 'strong', (subnode: any) => { | ||
let value = ''; | ||
|
||
visit(subnode, 'text', (textnode: any) => { | ||
if (['Note', 'Tip', 'Important', 'Warning', 'Caution'].includes(textnode.value)) { | ||
for (const item of gfmHighlight) { | ||
if (item.from === textnode.value) { | ||
value = item.to; | ||
} | ||
} | ||
} | ||
if (value) { | ||
subnode.type = 'text'; | ||
subnode.value = value; | ||
} | ||
}); | ||
}); | ||
}); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const replaceNBSP = (str: string) => { | ||
return str.replaceAll(' ', ' '); | ||
}; |