File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ local Element = require('lean.tui').Element
33local html = {}
44
55vim .api .nvim_set_hl (0 , ' tui.html.b' , { bold = true })
6+ vim .api .nvim_set_hl (0 , ' tui.html.summary' , { link = ' Title' })
67vim .api .nvim_set_hl (0 , ' tui.html.unsupported' , { link = ' ErrorMsg' })
78
89html .Tag = vim .defaulttable (function (tag )
1718
1819--- A `<details>` tag.
1920function html .Tag .details (children )
20- -- TODO: foldable, when it exists, and this should maybe go search for the
21- -- summary child and assemble it here so we have a "real" title.
22- return Element :titled {
23- title = ' ▼ ' ,
24- margin = 0 ,
25- body = children ,
26- }
21+ return Element :new { children = children }
2722end
2823
2924--- A `<summary>` tag (within `details`).
3025function html .Tag .summary (children )
31- return Element :new { children = children }
26+ return Element :new {
27+ text = ' ▼ ' ,
28+ hlgroup = ' tui.html.summary' ,
29+ children = children ,
30+ }
3231end
3332
3433--- Just render the children, as we don't (yet?) support passing through styles.
Original file line number Diff line number Diff line change @@ -39,16 +39,16 @@ describe('tui.html', function()
3939 end )
4040
4141 describe (' <summary>' , function ()
42- it (' renders summary as passthrough ' , function ()
42+ it (' renders summary with marker ' , function ()
4343 local el = Tag .summary { Element :new { text = ' sum' } }
44- assert .is .equal (' sum' , el :to_string ())
44+ assert .is .equal (' ▼ sum' , el :to_string ())
4545 end )
4646 end )
4747
4848 describe (' <details>' , function ()
4949 it (' renders details as titled block' , function ()
5050 local el = Tag .details { Element :new { text = ' body' } }
51- assert .is .equal (' ▼ body' , el :to_string ())
51+ assert .is .equal (' body' , el :to_string ())
5252 end )
5353 end )
5454
You can’t perform that action at this time.
0 commit comments