feat: add JavaScript cheatsheet.

This commit is contained in:
jaywcjlove
2022-09-26 17:13:24 +08:00
parent 789aa12440
commit 9fe3fcdc0d
6 changed files with 1749 additions and 13 deletions

View File

@ -0,0 +1,5 @@
export function htmlTagAddAttri(node) {
if (node && node.tagName === 'html') {
node.properties['data-color-mode'] = 'dark';
}
}

View File

@ -0,0 +1,6 @@
export function rehypeUrls(node) {
if (node.type === 'element' && node.properties.href && /.md/.test(node.properties.href)) {
let href = node.properties.href;
node.properties.href = href.replace(/([^\.\/\\]+)\.(md|markdown)/gi, '$1.html');
}
}