From bc67cf3ccdf935a0e2974fbbe5557a3d24931c54 Mon Sep 17 00:00:00 2001 From: Sergey Slipchenko Date: Tue, 12 Sep 2023 15:51:38 +0400 Subject: [PATCH] feat(gen_help_html): add anchors to help tags #25112 Fixes #21911 Co-authored by: wispl --- scripts/gen_help_html.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/gen_help_html.lua b/scripts/gen_help_html.lua index 5e06830336..c8e004e2ab 100644 --- a/scripts/gen_help_html.lua +++ b/scripts/gen_help_html.lua @@ -574,14 +574,15 @@ local function visit_node(root, level, lang_tree, headings, opt, stats) return '' end local el = in_heading and 'span' or 'code' - local s = ('%s<%s id="%s" class="%s">%s'):format(ws(), el, url_encode(tagname), cssclass, trimmed, el) + local encoded_tagname = url_encode(tagname) + local s = ('%s<%s id="%s" class="%s">%s'):format(ws(), el, encoded_tagname, cssclass, encoded_tagname, trimmed, el) if opt.old then s = fix_tab_after_conceal(s, node_text(root:next_sibling())) end if in_heading and prev ~= 'tag' then -- Don't set "id", let the heading use the tag as its "id" (used by search engines). - s = ('%s<%s class="%s">%s'):format(ws(), el, cssclass, trimmed, el) + s = ('%s<%s class="%s">%s'):format(ws(), el, cssclass, encoded_tagname, trimmed, el) -- Start the container for tags in a heading. -- This makes "justify-content:space-between" right-align the tags. --

foo bartag1 tag2

@@ -963,6 +964,7 @@ local function gen_css(fname) margin-bottom: 0; } + /* TODO: should this rule be deleted? help tags are rendered as or , not */ a.help-tag, a.help-tag:focus, a.help-tag:hover { color: inherit; text-decoration: none; @@ -977,6 +979,14 @@ local function gen_css(fname) margin-right: 0; float: right; } + .help-tag a, + .help-tag-right a { + color: inherit; + } + .help-tag a:not(:hover), + .help-tag-right a:not(:hover) { + text-decoration: none; + } h1 .help-tag, h2 .help-tag, h3 .help-tag { font-size: smaller; }