mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 12:25:05 +03:00
feat: Support multi-level remarks
This commit is contained in:
1 parent
fdbddbabce
commit
44e10ab071
1 file changed
+11
-1
@@ -29,6 +29,16 @@ function contentToMd(items: ContentItem[] = []): string {
|
||||
.trim()
|
||||
}
|
||||
|
||||
// Remarks can contain structured markdown (bullet lists, nested items, fenced
|
||||
// code blocks) where every newline is meaningful. Skip the soft-wrap collapse
|
||||
// and just join the items as-is.
|
||||
function rawContentToMd(items: ContentItem[] = []): string {
|
||||
return items
|
||||
.map((c) => c.text)
|
||||
.join('')
|
||||
.trim()
|
||||
}
|
||||
|
||||
function extractFence(text: string): string {
|
||||
const m = text.match(/^```[^\n]*\n([\s\S]*?)\n?```$/)
|
||||
return m ? m[1].trim() : text.trim()
|
||||
@@ -317,7 +327,7 @@ export function processSpec(specDir: string): { categories: SpecCategory[]; conf
|
||||
...(subcategory ? { subcategory } : {}),
|
||||
description: contentToMd(decl.comment?.summary ?? []),
|
||||
...(remarkTags.length
|
||||
? { remarks: remarkTags.map((t) => contentToMd(t.content ?? [])) }
|
||||
? { remarks: remarkTags.map((t) => rawContentToMd(t.content ?? [])) }
|
||||
: {}),
|
||||
parameters: (sig.parameters ?? []).map((p: any) => serializeParam(p, targetMap)),
|
||||
returnType: serializeType(sig.type, targetMap),
|
||||
|
||||
Reference in new issue
Block a user