@@ -37,6 +37,7 @@ local tag_mappings = {
3737 var = { left = " `" , right = " `" },
3838 kbd = { left = " `" , right = " `" },
3939 mark = { left = " `" , right = " `" },
40+ tt = { left = " `" , right = " `" },
4041 b = { left = " `" , right = " `" },
4142 strong = { left = " **" , right = " **" },
4243 i = { left = " _" , right = " _" },
@@ -70,6 +71,7 @@ local inline_tags = {
7071 " em" ,
7172 " abbr" ,
7273 " code" ,
74+ " tt" ,
7375 " i" ,
7476 " s" ,
7577 " sub" ,
@@ -227,13 +229,13 @@ function transpiler:eval(node)
227229 elseif node_type == " element" then
228230 local tag_node = node :named_child ()
229231 local tag_type = tag_node :type ()
230- local tag_name = self :get_node_text ( tag_node : named_child () )
232+ local tag_name = self :get_node_tag_name ( node )
231233
232234 if tag_type == " start_tag" then
233235 local children = self :filter_tag_children (node )
234236
235237 for _ , child in ipairs (children ) do
236- result = result .. self :eval_child (child , tag_name )
238+ result = result .. self :eval_child (child , node )
237239 end
238240 end
239241
@@ -289,17 +291,21 @@ function transpiler:eval(node)
289291end
290292
291293--- @param node TSNode
292- function transpiler :eval_child (node , parent_tag )
294+ function transpiler :eval_child (node , parent_node )
293295 local result = self :eval (node )
294296 local tag_name = self :get_node_tag_name (node )
295297 local sibling = node :next_named_sibling ()
298+ local parent_tag = self :get_node_tag_name (parent_node )
299+ local attributes = self :get_node_attributes (parent_node )
296300
297301 -- checks if there should be additional spaces/characters between two elements
298302 if sibling then
299303 local c_row_end , c_col_end = node :end_ ()
300304 local s_row_start , s_col_start = sibling :start ()
301305
302- if parent_tag == " pre" then
306+ -- The <pre> HTML element represents preformatted text
307+ -- which is to be presented exactly as written in the HTML file
308+ if parent_tag == " pre" or attributes .class == " _rfc-pre" then
303309 local row , col = c_row_end , c_col_end
304310 while row ~= s_row_start or col ~= s_col_start do
305311 local char = self :get_text_range (row , col , row , col + 1 )
0 commit comments