Skip to content

Commit c8aea41

Browse files
ci: apply automated fixes
1 parent 36c7ff8 commit c8aea41

File tree

8 files changed

+32
-31
lines changed

8 files changed

+32
-31
lines changed

src/components/CodeBlock.tsx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const LANG_ALIASES: Record<string, string> = {
1919
text: 'plaintext',
2020
}
2121

22-
2322
// Lazy highlighter singleton
2423
let highlighterPromise: Promise<HighlighterGeneric<any, any>> | null = null
2524
let mermaidInstance: Mermaid | null = null
@@ -91,10 +90,10 @@ function extractPreAttributes(html: string): {
9190
}
9291

9392
export function CodeBlock({
94-
isEmbedded,
95-
showTypeCopyButton = true,
96-
...props
97-
}: React.HTMLProps<HTMLPreElement> & {
93+
isEmbedded,
94+
showTypeCopyButton = true,
95+
...props
96+
}: React.HTMLProps<HTMLPreElement> & {
9897
isEmbedded?: boolean
9998
showTypeCopyButton?: boolean
10099
}) {
@@ -107,10 +106,10 @@ export function CodeBlock({
107106
const children = props.children as
108107
| undefined
109108
| {
110-
props: {
111-
children: string
112-
}
113-
}
109+
props: {
110+
children: string
111+
}
112+
}
114113

115114
const [copied, setCopied] = React.useState(false)
116115
const ref = React.useRef<any>(null)
@@ -131,7 +130,7 @@ export function CodeBlock({
131130

132131
React[
133132
typeof document !== 'undefined' ? 'useLayoutEffect' : 'useEffect'
134-
](() => {
133+
](() => {
135134
;(async () => {
136135
const themes = ['github-light', 'tokyo-night']
137136
const normalizedLang = LANG_ALIASES[lang] || lang
@@ -228,4 +227,4 @@ export function CodeBlock({
228227
{codeElement}
229228
</div>
230229
)
231-
}
230+
}

src/utils/markdown/plugins/collectHeadings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ export function rehypeCollectHeadings(
3939
file.data.headings = headings
4040
}
4141
}
42-
}
42+
}

src/utils/markdown/plugins/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ export const slugify = (value: string, fallback: string) => {
2323
export const isHeading = (node: unknown): node is Element =>
2424
isElement(node) && /^h[1-6]$/.test(node.tagName)
2525

26-
export const headingLevel = (node: Element) => Number(node.tagName.substring(1))
26+
export const headingLevel = (node: Element) => Number(node.tagName.substring(1))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export { rehypeParseCommentComponents } from './parseCommentComponents'
22
export { rehypeTransformCommentComponents } from './transformCommentComponents'
33
export { transformTabsComponent } from './transformTabsComponent'
4-
export { type MarkdownHeading, rehypeCollectHeadings } from './collectHeadings'
4+
export { type MarkdownHeading, rehypeCollectHeadings } from './collectHeadings'

src/utils/markdown/plugins/parseCommentComponents.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const rehypeParseCommentComponents = () => {
8383
if (
8484
isCommentNode(candidate) &&
8585
candidate.value.trim().toLowerCase() ===
86-
`${END_PREFIX}${normalizeComponentName(componentName)}`
86+
`${END_PREFIX}${normalizeComponentName(componentName)}`
8787
) {
8888
endIndex = cursor
8989
break
@@ -100,4 +100,4 @@ export const rehypeParseCommentComponents = () => {
100100
return [SKIP, index]
101101
})
102102
}
103-
}
103+
}

src/utils/markdown/plugins/transformCommentComponents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ export const rehypeTransformCommentComponents = () => {
2020
}
2121
})
2222
}
23-
}
23+
}

src/utils/markdown/plugins/transformTabsComponent.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function extractTabPanels(node): TabExtraction | null {
2626

2727
const tabs: TabDescriptor[] = []
2828
const panels = []
29-
let currentPanel= null
29+
let currentPanel = null
3030

3131
children.forEach((child: any) => {
3232
if (isHeading(child)) {
@@ -93,21 +93,19 @@ export function transformTabsComponent(node) {
9393
return
9494
}
9595

96-
const panelElements = result.panels.map(
97-
(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-
}),
106-
)
96+
const panelElements = result.panels.map((panelChildren, index) => ({
97+
type: 'element',
98+
tagName: 'md-tab-panel',
99+
properties: {
100+
'data-tab-slug': result.tabs[index]?.slug ?? `tab-${index + 1}`,
101+
'data-tab-index': String(index),
102+
},
103+
children: panelChildren,
104+
}))
107105

108106
node.properties = {
109107
...node.properties,
110108
'data-attributes': JSON.stringify({ tabs: result.tabs }),
111109
}
112110
node.children = panelElements
113-
}
111+
}

src/utils/markdown/processor.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ import rehypeAutolinkHeadings from 'rehype-autolink-headings'
99
import rehypeStringify from 'rehype-stringify'
1010
import { visit } from 'unist-util-visit'
1111
import { toString } from 'hast-util-to-string'
12-
import { rehypeCollectHeadings, rehypeParseCommentComponents, rehypeTransformCommentComponents } from '~/utils/markdown/plugins'
12+
import {
13+
rehypeCollectHeadings,
14+
rehypeParseCommentComponents,
15+
rehypeTransformCommentComponents,
16+
} from '~/utils/markdown/plugins'
1317

1418
export type MarkdownHeading = {
1519
id: string

0 commit comments

Comments
 (0)