Skip to content

Commit 8cd8bab

Browse files
committed
Fix alias markdown rendering (use header)
1 parent f69f5fe commit 8cd8bab

2 files changed

Lines changed: 16 additions & 13 deletions

File tree

script/core/hover/description.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,10 @@ local function buildEnumChunk(docType, name, uri)
257257
if #enums == 0 then
258258
return nil
259259
end
260-
lines[#lines+1] = ('**%s**:'):format(name)
260+
if #lines > 0 and lines[#lines] ~= "" then
261+
lines[#lines+1] = ""
262+
end
263+
lines[#lines+1] = ('#### %s:'):format(name)
261264
for _, enum in ipairs(enums) do
262265
local suffix = (enum.default and ' (default)')
263266
or (enum.additional and ' (additional)')

test/crossfile/hover.lua

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ function f(x: string|"选项1"|"选项2")
400400
401401
---
402402
403-
**x**:
403+
#### x:
404404
- `"选项1"` — 注释1
405405
- `"选项2"` (default) — 注释2]]
406406
}
@@ -427,7 +427,7 @@ function f(x: "选项1"|"选项2")
427427
428428
---
429429
430-
**x**:
430+
#### x:
431431
- `"选项1"` — 注释1
432432
- `"选项2"` (default) — 注释2]]
433433
}
@@ -455,7 +455,7 @@ function f()
455455
456456
---
457457
458-
**x**:
458+
#### x:
459459
- `"选项1"` — 注释1
460460
- `"选项2"` (default) — 注释2]]
461461
}
@@ -483,7 +483,7 @@ function f()
483483
484484
---
485485
486-
**return #1**:
486+
#### return #1:
487487
- `"选项1"` — 注释1
488488
- `"选项2"` (default) — 注释2]]
489489
}
@@ -709,7 +709,7 @@ function f(a: boolean)
709709
710710
@*param* `a` — xxx
711711
712-
**a**:
712+
#### a:
713713
- `true` — ttt
714714
- `false` — fff]]}
715715

@@ -1010,7 +1010,7 @@ function f(p: 'a'|'b')
10101010
10111011
---
10121012
1013-
**p**:
1013+
#### p:
10141014
- `'a'` — comment 1
10151015
comment 2
10161016
- `'b'` — comment 3
@@ -1231,19 +1231,19 @@ function f(p: 'a1'|'a2', ...'a3'|'a4')
12311231
12321232
---
12331233
1234-
**p**:
1234+
#### p:
12351235
- `'a1'`
12361236
- `'a2'`
12371237
1238-
**...(param)**:
1238+
#### ...(param):
12391239
- `'a3'`
12401240
- `'a4'`
12411241
1242-
**ret1**:
1242+
#### ret1:
12431243
- `'r1'`
12441244
- `'r2'`
12451245
1246-
**...(return)**:
1246+
#### ...(return):
12471247
- `'r3'`
12481248
- `'r4'`]]
12491249
}
@@ -1496,7 +1496,7 @@ local x: 1|2
14961496
14971497
---
14981498
1499-
**A**:
1499+
#### A:
15001500
- `1` — comment1
15011501
- `2` — comment2]]
15021502
}
@@ -1628,7 +1628,7 @@ local someValue: "#"
16281628
16291629
---
16301630
1631-
**someType**:
1631+
#### someType:
16321632
- `"#"` — description]]
16331633
}
16341634

0 commit comments

Comments
 (0)