Skip to content

Commit 6e3cdfc

Browse files
[autofix.ci] apply automated fixes
1 parent 759dbfc commit 6e3cdfc

3 files changed

Lines changed: 18 additions & 8 deletions

File tree

server/utils/docs/render.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ async function renderMergedSymbol(
143143
// Description
144144
if (symbol.jsDoc?.doc) {
145145
const description = symbol.jsDoc.doc.trim()
146-
lines.push(`<div class="docs-description">${await renderMarkdown(description, symbolLookup)}</div>`)
146+
lines.push(
147+
`<div class="docs-description">${await renderMarkdown(description, symbolLookup)}</div>`,
148+
)
147149
}
148150

149151
// JSDoc tags

server/utils/docs/text.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,15 @@ export async function renderMarkdown(text: string, symbolLookup: SymbolLookup):
103103
// Pattern handles:
104104
// - Optional whitespace before/after language identifier
105105
// - \r\n, \n, or \r line endings
106-
const codeBlockData: Array<{ lang: string, code: string }> = []
107-
let result = text.replace(/```[ \t]*(\w*)[ \t]*(?:\r\n|\r|\n)([\s\S]*?)(?:\r\n|\r|\n)?```/g, (_, lang, code) => {
108-
const index = codeBlockData.length
109-
codeBlockData.push({ lang: lang || 'text', code: code.trim() })
110-
return `__CODE_BLOCK_${index}__`
111-
})
106+
const codeBlockData: Array<{ lang: string; code: string }> = []
107+
let result = text.replace(
108+
/```[ \t]*(\w*)[ \t]*(?:\r\n|\r|\n)([\s\S]*?)(?:\r\n|\r|\n)?```/g,
109+
(_, lang, code) => {
110+
const index = codeBlockData.length
111+
codeBlockData.push({ lang: lang || 'text', code: code.trim() })
112+
return `__CODE_BLOCK_${index}__`
113+
},
114+
)
112115

113116
// Now process the rest (JSDoc links, HTML escaping, etc.)
114117
result = parseJsDocLinks(result, symbolLookup)

test/unit/docs-text.spec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { describe, expect, it } from 'vitest'
2-
import { escapeHtml, parseJsDocLinks, renderMarkdown, stripAnsi } from '../../server/utils/docs/text'
2+
import {
3+
escapeHtml,
4+
parseJsDocLinks,
5+
renderMarkdown,
6+
stripAnsi,
7+
} from '../../server/utils/docs/text'
38
import type { SymbolLookup } from '../../server/utils/docs/types'
49

510
describe('stripAnsi', () => {

0 commit comments

Comments
 (0)