Skip to content

Commit 2f0116e

Browse files
committed
Fix alias markdown rendering (use header)
1 parent bd57557 commit 2f0116e

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

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
@@ -431,7 +431,7 @@ function f(x: string|"选项1"|"选项2")
431431
432432
---
433433
434-
**x**:
434+
#### x:
435435
- `"选项1"` — 注释1
436436
- `"选项2"` (default) — 注释2]]
437437
}
@@ -458,7 +458,7 @@ function f(x: "选项1"|"选项2")
458458
459459
---
460460
461-
**x**:
461+
#### x:
462462
- `"选项1"` — 注释1
463463
- `"选项2"` (default) — 注释2]]
464464
}
@@ -486,7 +486,7 @@ function f()
486486
487487
---
488488
489-
**x**:
489+
#### x:
490490
- `"选项1"` — 注释1
491491
- `"选项2"` (default) — 注释2]]
492492
}
@@ -514,7 +514,7 @@ function f()
514514
515515
---
516516
517-
**return #1**:
517+
#### return #1:
518518
- `"选项1"` — 注释1
519519
- `"选项2"` (default) — 注释2]]
520520
}
@@ -740,7 +740,7 @@ function f(a: boolean)
740740
741741
@*param* `a` — xxx
742742
743-
**a**:
743+
#### a:
744744
- `true` — ttt
745745
- `false` — fff]]}
746746

@@ -1041,7 +1041,7 @@ function f(p: 'a'|'b')
10411041
10421042
---
10431043
1044-
**p**:
1044+
#### p:
10451045
- `'a'` — comment 1
10461046
comment 2
10471047
- `'b'` — comment 3
@@ -1262,19 +1262,19 @@ function f(p: 'a1'|'a2', ...'a3'|'a4')
12621262
12631263
---
12641264
1265-
**p**:
1265+
#### p:
12661266
- `'a1'`
12671267
- `'a2'`
12681268
1269-
**...(param)**:
1269+
#### ...(param):
12701270
- `'a3'`
12711271
- `'a4'`
12721272
1273-
**ret1**:
1273+
#### ret1:
12741274
- `'r1'`
12751275
- `'r2'`
12761276
1277-
**...(return)**:
1277+
#### ...(return):
12781278
- `'r3'`
12791279
- `'r4'`]]
12801280
}
@@ -1527,7 +1527,7 @@ local x: 1|2
15271527
15281528
---
15291529
1530-
**A**:
1530+
#### A:
15311531
- `1` — comment1
15321532
- `2` — comment2]]
15331533
}
@@ -1659,7 +1659,7 @@ local someValue: "#"
16591659
16601660
---
16611661
1662-
**someType**:
1662+
#### someType:
16631663
- `"#"` — description]]
16641664
}
16651665

0 commit comments

Comments
 (0)