diff options
author | Sergey Slipchenko <faergeek@gmail.com> | 2023-09-12 15:51:38 +0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-12 04:51:38 -0700 |
commit | bc67cf3ccdf935a0e2974fbbe5557a3d24931c54 (patch) | |
tree | 86b7d616cdd837fd3f07d3dbb3bac417db7f99b0 /scripts/gen_help_html.lua | |
parent | 7a76fb8547548304450b59624f9c75a554396504 (diff) | |
download | rneovim-bc67cf3ccdf935a0e2974fbbe5557a3d24931c54.tar.gz rneovim-bc67cf3ccdf935a0e2974fbbe5557a3d24931c54.tar.bz2 rneovim-bc67cf3ccdf935a0e2974fbbe5557a3d24931c54.zip |
feat(gen_help_html): add anchors to help tags #25112
Fixes #21911
Co-authored by: wispl
Diffstat (limited to 'scripts/gen_help_html.lua')
-rw-r--r-- | scripts/gen_help_html.lua | 14 |
1 files 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</%s>'):format(ws(), el, url_encode(tagname), cssclass, trimmed, el) + local encoded_tagname = url_encode(tagname) + local s = ('%s<%s id="%s" class="%s"><a href="#%s">%s</a></%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</%s>'):format(ws(), el, cssclass, trimmed, el) + s = ('%s<%s class="%s"><a href="#%s">%s</a></%s>'):format(ws(), el, cssclass, encoded_tagname, trimmed, el) -- Start the <span> container for tags in a heading. -- This makes "justify-content:space-between" right-align the tags. -- <h2>foo bar<span>tag1 tag2</span></h2> @@ -963,6 +964,7 @@ local function gen_css(fname) margin-bottom: 0; } + /* TODO: should this rule be deleted? help tags are rendered as <code> or <span>, not <a> */ 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; } |