From 72892aab066a58524d670777512e9cab45e7310d Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 1 Oct 2024 12:51:16 +0200 Subject: docs(gen_help_html.lua): h4 pseudo-heading layout Problem: The
hack in a0c64fe816f8 causes weird layout if a "h4 pseudo-heading" is not the only tag on the line. For example in the help text below, the "*'buflisted'*" tag was treated as h4 and followed by
, which is obviously wrong: *'buflisted'* *'bl'* *'nobuflisted'* *'nobl'* *E85* 'buflisted' 'bl' boolean (default on) Solution: Only treat a tag as "h4 pseudo-heading" if it is the only tag in the line. This is fragile, but in practice seems to get the right balance. --- scripts/gen_help_html.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/gen_help_html.lua b/scripts/gen_help_html.lua index 20aeb2791e..f6e799508b 100644 --- a/scripts/gen_help_html.lua +++ b/scripts/gen_help_html.lua @@ -670,7 +670,7 @@ local function visit_node(root, level, lang_tree, headings, opt, stats) return text end local in_heading = vim.list_contains({ 'h1', 'h2', 'h3' }, parent) - local h4 = (not in_heading and get_indent(node_text()) > 8) + local h4 = not in_heading and not next_ and get_indent(node_text()) > 8 -- h4 pseudo-heading local cssclass = h4 and 'help-tag-right' or 'help-tag' local tagname = node_text(root:child(1), false) if vim.tbl_count(stats.first_tags) < 2 then -- cgit