Skip to content

Commit 5d5f9f2

Browse files
ci: apply automated fixes
1 parent 65c7c55 commit 5d5f9f2

File tree

5 files changed

+29
-22
lines changed

5 files changed

+29
-22
lines changed

src/utils/markdown/plugins/collectHeadings.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ export function rehypeCollectHeadings(initialHeadings?: MarkdownHeading[]) {
1919
return
2020
}
2121

22-
const id = typeof node.properties?.id === 'string' ? node.properties.id : ''
22+
const id =
23+
typeof node.properties?.id === 'string' ? node.properties.id : ''
2324
if (!id) {
2425
return
2526
}

src/utils/markdown/plugins/helpers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ export function parseDescriptor(descriptor: string) {
3232
export const isCommentNode = (value: unknown): value is { value: string } =>
3333
Boolean(
3434
value &&
35-
typeof value === 'object' &&
36-
'type' in value &&
37-
value.type === 'comment',
35+
typeof value === 'object' &&
36+
'type' in value &&
37+
value.type === 'comment',
3838
)
3939

4040
export const slugify = (value: string, fallback: string) => {
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
export { rehypeParseCommentComponents } from './parseCommentComponents'
22
export { rehypeTransformCommentComponents } from './transformCommentComponents'
33
export { transformTabsComponent } from './transformTabsComponent'
4-
export {
5-
type MarkdownHeading,
6-
rehypeCollectHeadings,
7-
} from './collectHeadings'
4+
export { type MarkdownHeading, rehypeCollectHeadings } from './collectHeadings'
85
export { rehypeShikiHighlight } from './syntaxHighlight'

src/utils/markdown/plugins/syntaxHighlight.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ export const rehypeShikiHighlight = () => {
6060
visit(tree, 'element', (node: Element) => {
6161
if (node.tagName !== 'pre') return
6262
const codeNode = node.children?.[0]
63-
if (!codeNode || codeNode.type !== 'element' || codeNode.tagName !== 'code') {
63+
if (
64+
!codeNode ||
65+
codeNode.type !== 'element' ||
66+
codeNode.tagName !== 'code'
67+
) {
6468
return
6569
}
6670

@@ -80,7 +84,8 @@ export const rehypeShikiHighlight = () => {
8084
highlightTasks.push(
8185
(async () => {
8286
const normalizedLang = LANG_ALIASES[langRaw] ?? (langRaw as Lang)
83-
const effectiveLang = normalizedLang === 'mermaid' ? 'plaintext' : normalizedLang
87+
const effectiveLang =
88+
normalizedLang === 'mermaid' ? 'plaintext' : normalizedLang
8489

8590
if (
8691
!highlighter
@@ -127,11 +132,13 @@ export const rehypeShikiHighlight = () => {
127132
),
128133
)
129134

130-
const fragmentTrees = htmlFragments.map((fragment) =>
131-
fragmentParser.parse(fragment) as Root,
135+
const fragmentTrees = htmlFragments.map(
136+
(fragment) => fragmentParser.parse(fragment) as Root,
132137
)
133138

134-
node.children = fragmentTrees.flatMap((fragmentTree) => fragmentTree.children)
139+
node.children = fragmentTrees.flatMap(
140+
(fragmentTree) => fragmentTree.children,
141+
)
135142
})(),
136143
)
137144
})

src/utils/markdown/plugins/transformTabsComponent.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,17 @@ export function transformTabsComponent(node: Element) {
9494
return
9595
}
9696

97-
const panelElements: Element[] = result.panels.map((panelChildren, index) => ({
98-
type: 'element',
99-
tagName: 'md-tab-panel',
100-
properties: {
101-
'data-tab-slug': result.tabs[index]?.slug ?? `tab-${index + 1}`,
102-
'data-tab-index': String(index),
103-
},
104-
children: panelChildren,
105-
}))
97+
const panelElements: Element[] = result.panels.map(
98+
(panelChildren, index) => ({
99+
type: 'element',
100+
tagName: 'md-tab-panel',
101+
properties: {
102+
'data-tab-slug': result.tabs[index]?.slug ?? `tab-${index + 1}`,
103+
'data-tab-index': String(index),
104+
},
105+
children: panelChildren,
106+
}),
107+
)
106108

107109
node.properties = {
108110
...node.properties,

0 commit comments

Comments
 (0)