mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
feat(gen_help_html): add anchors to help tags #25112
Fixes #21911 Co-authored by: wispl
This commit is contained in:
parent
7a76fb8547
commit
bc67cf3ccd
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user