Skip to content

Commit 0fbcf71

Browse files
committed
re align text
1 parent 612f8a8 commit 0fbcf71

90 files changed

Lines changed: 89081 additions & 13 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/app/docs/[version]/api/[...module]/page.tsx

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import {
77
summary,
88
} from '@/lib/versioned-docs'
99

10+
// matches: "name: desc" "name (type): desc" "name : type"
11+
const PARAM_RE = /^([A-Za-z_]\w*)\s*(?:\([^)]*\))?\s*:\s*(.+)/
12+
1013
function DocText({ value }: { value: string }) {
1114
if (!value) return null
1215
const lines = value.split('\n')
@@ -22,33 +25,42 @@ function DocText({ value }: { value: string }) {
2225
for (let index = 0; index < lines.length; index += 1) {
2326
const line = lines[index].trim()
2427
const next = lines[index + 1]?.trim() || ''
28+
2529
if (line && /^-{3,}$/.test(next)) {
2630
flushParagraph()
27-
blocks.push(<h4 key={`h-${blocks.length}`}>{line}</h4>)
31+
blocks.push(<h4 key={`h-${blocks.length}`}>{line.replace(/:$/, '')}</h4>)
2832
index += 1
2933
continue
3034
}
31-
if (!line) {
32-
flushParagraph()
33-
continue
34-
}
35-
if (/^[A-Za-z_][\w, ]*\s*:\s*.+/.test(line)) {
35+
if (!line) { flushParagraph(); continue }
36+
37+
// strip leading bullet (• or -) then try to match as a named parameter
38+
const isBullet = /^[\-]/.test(line)
39+
const inner = isBullet ? line.replace(/^[\-]\s*/, '') : line
40+
const m = PARAM_RE.exec(inner)
41+
42+
if (m) {
3643
flushParagraph()
37-
const [name, ...typeParts] = line.split(':')
3844
blocks.push(
3945
<div className="docParameter" key={`d-${blocks.length}`}>
40-
<code>{name.trim()}</code>
41-
<span>{typeParts.join(':').trim()}</span>
46+
<code>{m[1]}</code>
47+
<span>{m[2].trim()}</span>
4248
</div>,
4349
)
4450
continue
4551
}
52+
53+
// plain bullet with no name:desc pattern → list item
54+
if (isBullet) {
55+
flushParagraph()
56+
blocks.push(<li key={`li-${blocks.length}`}>{inner}</li>)
57+
continue
58+
}
59+
4660
paragraph.push(line)
4761
}
4862
flushParagraph()
49-
return (
50-
<div className="docText">{blocks.slice(0, 80)}</div>
51-
)
63+
return <div className="docText">{blocks.slice(0, 80)}</div>
5264
}
5365

5466
export default async function ModuleReference({

docs/content/generated/snapshots/0314f730222b1087.json

Lines changed: 1069 additions & 0 deletions
Large diffs are not rendered by default.

docs/content/generated/snapshots/0a99c886dd9ff5d0.json

Lines changed: 992 additions & 0 deletions
Large diffs are not rendered by default.

docs/content/generated/snapshots/0b1893b2e2572dc3.json

Lines changed: 992 additions & 0 deletions
Large diffs are not rendered by default.

docs/content/generated/snapshots/0bc1c82574149130.json

Lines changed: 1019 additions & 0 deletions
Large diffs are not rendered by default.

docs/content/generated/snapshots/121478f7036f75e7.json

Lines changed: 1383 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)