:::")',
)
- let label = null
- if (properties && properties['has-directive-label']) {
- label = children[0] // The first child is the label
- children = children.slice(1)
- label.tagName = 'div' // Change the tag to
- }
+ const { label, childrenToReturn } = properties?.['has-directive-label']
+ ? {
+ label: { ...children[0], tagName: 'div' },
+ childrenToReturn: children.slice(1),
+ }
+ : {
+ label: null,
+ childrenToReturn: children,
+ }
- return h(`blockquote`, { class: `admonition bdm-${type}` }, [
- h('span', { class: `bdm-title` }, label ? label : type.toUpperCase()),
- ...children,
+ return h('blockquote', { class: `admonition bdm-${type}` }, [
+ h('span', { class: 'bdm-title' }, label ? label : type.toUpperCase()),
+ ...childrenToReturn,
])
}
diff --git a/src/plugins/rehype-component-github-card.mjs b/src/plugins/rehype-component-github-card.mjs
index 3923f194c..13c0ee661 100644
--- a/src/plugins/rehype-component-github-card.mjs
+++ b/src/plugins/rehype-component-github-card.mjs
@@ -32,7 +32,7 @@ export function GithubCardComponent(properties, children) {
'Waiting...',
)
- const nTitle = h(`div`, { class: 'gc-titlebar' }, [
+ const nTitle = h('div', { class: 'gc-titlebar' }, [
h('div', { class: 'gc-titlebar-left' }, [
h('div', { class: 'gc-owner' }, [
nAvatar,
diff --git a/src/plugins/remark-directive-rehype.js b/src/plugins/remark-directive-rehype.js
index 2d6b55039..96b8c3e90 100644
--- a/src/plugins/remark-directive-rehype.js
+++ b/src/plugins/remark-directive-rehype.js
@@ -1,4 +1,3 @@
-// biome-ignore lint/suspicious/noShadowRestrictedNames:
import { h } from 'hastscript'
import { visit } from 'unist-util-visit'
@@ -10,7 +9,8 @@ export function parseDirectiveNode() {
node.type === 'leafDirective' ||
node.type === 'textDirective'
) {
- const data = node.data || (node.data = {})
+ node.data = node.data || {}
+ const data = node.data
node.attributes = node.attributes || {}
if (
node.children.length > 0 &&
diff --git a/src/plugins/remark-excerpt.js b/src/plugins/remark-excerpt.js
index c88a0459d..34421e7a8 100644
--- a/src/plugins/remark-excerpt.js
+++ b/src/plugins/remark-excerpt.js
@@ -1,4 +1,4 @@
-import { toString } from 'mdast-util-to-string'
+import { toString as mdastToString } from 'mdast-util-to-string'
/* Use the post's first paragraph as the excerpt */
export function remarkExcerpt() {
@@ -8,7 +8,7 @@ export function remarkExcerpt() {
if (node.type !== 'paragraph') {
continue
}
- excerpt = toString(node)
+ excerpt = mdastToString(node)
break
}
data.astro.frontmatter.excerpt = excerpt