format all code (#386)

This commit is contained in:
Katsuyuki Karasawa
2025-04-08 23:08:31 +09:00
committed by GitHub
parent 7ea2f7f40f
commit 286b050fa8
61 changed files with 1329 additions and 1307 deletions
+26 -26
View File
@@ -1,30 +1,30 @@
import { h } from 'hastscript'
import { visit } from 'unist-util-visit'
import { h } from "hastscript";
import { visit } from "unist-util-visit";
export function parseDirectiveNode() {
return (tree, { data }) => {
visit(tree, node => {
if (
node.type === 'containerDirective' ||
node.type === 'leafDirective' ||
node.type === 'textDirective'
) {
// biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
const data = node.data || (node.data = {})
node.attributes = node.attributes || {}
if (
node.children.length > 0 &&
node.children[0].data &&
node.children[0].data.directiveLabel
) {
// Add a flag to the node to indicate that it has a directive label
node.attributes['has-directive-label'] = true
}
const hast = h(node.name, node.attributes)
return (tree, { data }) => {
visit(tree, (node) => {
if (
node.type === "containerDirective" ||
node.type === "leafDirective" ||
node.type === "textDirective"
) {
// biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
const data = node.data || (node.data = {});
node.attributes = node.attributes || {};
if (
node.children.length > 0 &&
node.children[0].data &&
node.children[0].data.directiveLabel
) {
// Add a flag to the node to indicate that it has a directive label
node.attributes["has-directive-label"] = true;
}
const hast = h(node.name, node.attributes);
data.hName = hast.tagName
data.hProperties = hast.properties
}
})
}
data.hName = hast.tagName;
data.hProperties = hast.properties;
}
});
};
}