@@ -56,14 +56,18 @@ function Render:setup()
5656 -- ensure delimiter and rows exist
5757 local delim_node = nil --- @type render.md.Node ?
5858 local row_nodes = {} --- @type render.md.Node[]
59+ local types = {
60+ delim = ' pipe_table_delimiter_row' ,
61+ row = { ' pipe_table_header' , ' pipe_table_row' },
62+ skip = { ' block_continuation' },
63+ }
5964 self .node :for_each_child (function (node )
60- if node .type == ' pipe_table_delimiter_row ' then
65+ if node .type == types . delim then
6166 delim_node = node
6267 elseif self .context .view :overlaps (node :get ()) then
63- local row_types = { ' pipe_table_header' , ' pipe_table_row' }
64- if vim .tbl_contains (row_types , node .type ) then
68+ if vim .tbl_contains (types .row , node .type ) then
6569 row_nodes [# row_nodes + 1 ] = node
66- else
70+ elseif not vim . tbl_contains ( types . skip , node . type ) then
6771 log .unhandled (self .context .buf , ' markdown' , ' row' , node .type )
6872 end
6973 end
@@ -145,13 +149,13 @@ end
145149--- @param node render.md.Node
146150--- @return render.md.table.Alignment
147151function Render .alignment (node )
148- local has_left = node :child (' pipe_table_align_left' ) ~= nil
149- local has_right = node :child (' pipe_table_align_right' ) ~= nil
150- if has_left and has_right then
152+ local left = node :child (' pipe_table_align_left' )
153+ local right = node :child (' pipe_table_align_right' )
154+ if left and right then
151155 return Alignment .center
152- elseif has_left then
156+ elseif left then
153157 return Alignment .left
154- elseif has_right then
158+ elseif right then
155159 return Alignment .right
156160 else
157161 return Alignment .default
0 commit comments