From 63e297da167713e17fd271958b4109ea44e7075a Mon Sep 17 00:00:00 2001 From: ache Date: Fri, 9 Aug 2024 04:12:37 +0200 Subject: Lint JavaScript --- src/build/special_box.mjs | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'src/build/special_box.mjs') diff --git a/src/build/special_box.mjs b/src/build/special_box.mjs index 1457a98..f1631b6 100644 --- a/src/build/special_box.mjs +++ b/src/build/special_box.mjs @@ -1,39 +1,40 @@ -import {visit} from 'unist-util-visit'; +import { visit } from "unist-util-visit"; // This plugin is an example to let users write HTML with directives. // It’s informative but rather useless. // See below for others examples. /** @type {import('unified').Plugin<[], import('mdast').Root>} */ export default function specialBox() { - return tree => { - visit(tree, node => { - if (node.type === 'containerDirective' && ( - node.name === 'attention' - || node.name === 'question' - || node.name === 'note' - || node.name === 'information')) { + return (tree) => { + visit(tree, (node) => { + if ( + node.type === "containerDirective" && + (node.name === "attention" || + node.name === "question" || + node.name === "note" || + node.name === "information") + ) { const data = node.data || (node.data = {}); - data.hName = 'div'; + data.hName = "div"; data.hProperties = { - className: 'special-box ' + node.name, + className: "special-box " + node.name, }; } - if (node.type === 'containerDirective' && node.name === 'details') { - if(node.children.length > 0 && node.children[0].type == "paragraph") { + if (node.type === "containerDirective" && node.name === "details") { + if (node.children.length > 0 && node.children[0].type == "paragraph") { node.children[0] = { type: "containerDirective", data: { - hName: 'summary' + hName: "summary", }, - children: node.children[0].children + children: node.children[0].children, }; - const data = node.data || (node.data = {}); - data.hName = 'details'; + const data = node.data || (node.data = {}); + data.hName = "details"; } } }); }; } - -- cgit v1.2.3-70-g09d2