Files
.github
docs
scripts
nodes
footer.mjs
header.mjs
htmlTagAddAttri.mjs
logo.mjs
rehypeUrls.mjs
build.mjs
create.mjs
index.mjs
style.css
.gitignore
LICENSE
README.md
package.json
renovate.json
reference/scripts/nodes/htmlTagAddAttri.mjs
2022-09-27 23:09:51 +08:00

8 lines
240 B
JavaScript

export function htmlTagAddAttri(node, { isHome }) {
if (node && node.tagName === 'html') {
node.properties['data-color-mode'] = 'dark';
}
if (node && node.tagName === 'body' && isHome) {
node.properties.class = ['home'];
}
}