feat(docs): parse [optional]

This commit is contained in:
Justin M. Keyes 2023-06-26 13:03:31 +02:00
parent b13e63db1d
commit f9db95e5f9
9 changed files with 47 additions and 39 deletions

View File

@ -652,7 +652,7 @@ list of the current window.
list.
If [count] is omitted, the {name}s are added just
after the current entry in the argument list.
Otherwise they are added after the [count]'th file.
Otherwise they are added after the [count]th file.
If the argument list is "a b c", and "b" is the
current argument, then these commands result in:
command new argument list ~

View File

@ -256,7 +256,7 @@ g<End> Like |g$| but to the last non-blank character
|exclusive| motion. Ceci n'est pas une pipe.
*f*
f{char} To [count]'th occurrence of {char} to the right. The
f{char} To [count]th occurrence of {char} to the right. The
cursor is placed on {char} |inclusive|.
{char} can be entered as a digraph |digraph-arg|.
When 'encoding' is set to Unicode, composing
@ -266,18 +266,18 @@ f{char} To [count]'th occurrence of {char} to the right. The
|i_CTRL-^|.
*F*
F{char} To the [count]'th occurrence of {char} to the left.
F{char} To the [count]th occurrence of {char} to the left.
The cursor is placed on {char} |exclusive|.
{char} can be entered like with the |f| command.
*t*
t{char} Till before [count]'th occurrence of {char} to the
t{char} Till before [count]th occurrence of {char} to the
right. The cursor is placed on the character left of
{char} |inclusive|.
{char} can be entered like with the |f| command.
*T*
T{char} Till after [count]'th occurrence of {char} to the
T{char} Till after [count]th occurrence of {char} to the
left. The cursor is placed on the character right of
{char} |exclusive|.
{char} can be entered like with the |f| command.
@ -604,14 +604,14 @@ ib "inner block", select [count] blocks, from "[count] [("
a> *v_a>* *v_a<* *a>* *a<*
a< "a <> block", select [count] <> blocks, from the
[count]'th unmatched '<' backwards to the matching
[count]th unmatched '<' backwards to the matching
'>', including the '<' and '>'. The |cpo-M| option flag
is used to handle escaped '<' and '>'.
When used in Visual mode it is made charwise.
i> *v_i>* *v_i<* *i>* *i<*
i< "inner <> block", select [count] <> blocks, from
the [count]'th unmatched '<' backwards to the matching
the [count]th unmatched '<' backwards to the matching
'>', excluding the '<' and '>'. It's an error to
select an empty inner block like "<>". The |cpo-M|
option flag is used to handle escaped '<' and '>'.
@ -619,14 +619,14 @@ i< "inner <> block", select [count] <> blocks, from
*v_at* *at*
at "a tag block", select [count] tag blocks, from the
[count]'th unmatched "<aaa>" backwards to the matching
[count]th unmatched "<aaa>" backwards to the matching
"</aaa>", including the "<aaa>" and "</aaa>".
See |tag-blocks| about the details.
When used in Visual mode it is made charwise.
*v_it* *it*
it "inner tag block", select [count] tag blocks, from the
[count]'th unmatched "<aaa>" backwards to the matching
[count]th unmatched "<aaa>" backwards to the matching
"</aaa>", excluding the "<aaa>" and "</aaa>".
See |tag-blocks| about the details.
When used in Visual mode it is made charwise.

View File

@ -4,7 +4,7 @@
NVIM REFERENCE MANUAL
Notable changes in Nvim 0.9 from 0.8 *news-0.9*
Notable changes in Nvim 0.9 since 0.8 *news-0.9*
Type |gO| to see the table of contents.

View File

@ -4,9 +4,7 @@
NVIM REFERENCE MANUAL
Notable changes in Nvim 0.10 from 0.9 *news*
For changes in Nvim 0.9, see |news-0.9|.
Notable changes in Nvim 0.10 since 0.9 (see also |news-0.9|) *news*
Type |gO| to see the table of contents.

View File

@ -15,36 +15,36 @@ explanations are in chapter 27 |usr_27.txt|.
1. Search commands *search-commands*
*/*
/{pattern}[/]<CR> Search forward for the [count]'th occurrence of
/{pattern}[/]<CR> Search forward for the [count]th occurrence of
{pattern} |exclusive|.
/{pattern}/{offset}<CR> Search forward for the [count]'th occurrence of
/{pattern}/{offset}<CR> Search forward for the [count]th occurrence of
{pattern} and go |{offset}| lines up or down.
|linewise|.
*/<CR>*
/<CR> Search forward for the [count]'th occurrence of the
/<CR> Search forward for the [count]th occurrence of the
latest used pattern |last-pattern| with latest used
|{offset}|.
//{offset}<CR> Search forward for the [count]'th occurrence of the
//{offset}<CR> Search forward for the [count]th occurrence of the
latest used pattern |last-pattern| with new
|{offset}|. If {offset} is empty no offset is used.
*?*
?{pattern}[?]<CR> Search backward for the [count]'th previous
?{pattern}[?]<CR> Search backward for the [count]th previous
occurrence of {pattern} |exclusive|.
?{pattern}?{offset}<CR> Search backward for the [count]'th previous
?{pattern}?{offset}<CR> Search backward for the [count]th previous
occurrence of {pattern} and go |{offset}| lines up or
down |linewise|.
*?<CR>*
?<CR> Search backward for the [count]'th occurrence of the
?<CR> Search backward for the [count]th occurrence of the
latest used pattern |last-pattern| with latest used
|{offset}|.
??{offset}<CR> Search backward for the [count]'th occurrence of the
??{offset}<CR> Search backward for the [count]th occurrence of the
latest used pattern |last-pattern| with new
|{offset}|. If {offset} is empty no offset is used.
@ -59,7 +59,7 @@ N Repeat the latest "/" or "?" [count] times in
opposite direction. |last-pattern|
*star* *E348* *E349*
* Search forward for the [count]'th occurrence of the
* Search forward for the [count]th occurrence of the
word nearest to the cursor. The word used for the
search is the first of:
1. the keyword under the cursor |'iskeyword'|

View File

@ -213,7 +213,7 @@ N is used to indicate an optional count that can be given before the command.
*Q_ta* Using tags
|:ta| :ta[g][!] {tag} jump to tag {tag}
|:ta| :[count]ta[g][!] jump to [count]'th newer tag in tag list
|:ta| :[count]ta[g][!] jump to [count]th newer tag in tag list
|CTRL-]| CTRL-] jump to the tag under cursor, unless changes
have been made
|:ts| :ts[elect][!] [tag] list matching tags and select one to jump to
@ -224,10 +224,10 @@ N is used to indicate an optional count that can be given before the command.
|:tags| :tags print tag list
|CTRL-T| N CTRL-T jump back from Nth older tag in tag list
|:po| :[count]po[p][!] jump back from [count]'th older tag in tag list
|:tnext| :[count]tn[ext][!] jump to [count]'th next matching tag
|:tp| :[count]tp[revious][!] jump to [count]'th previous matching tag
|:tr| :[count]tr[ewind][!] jump to [count]'th matching tag
|:po| :[count]po[p][!] jump back from [count]th older tag in tag list
|:tnext| :[count]tn[ext][!] jump to [count]th next matching tag
|:tp| :[count]tp[revious][!] jump to [count]th previous matching tag
|:tr| :[count]tr[ewind][!] jump to [count]th matching tag
|:tl| :tl[ast][!] jump to last matching tag
|:ptag| :pt[ag] {tag} open a preview window to show tag {tag}

View File

@ -954,10 +954,7 @@ get_lang({filetype}) *vim.treesitter.language.get_lang()*
(`string?`)
inspect({lang}) *vim.treesitter.language.inspect()*
Inspects the provided language.
Inspecting provides some useful information on the language like node
names, ...
Gets some useful information on the language like node names, ...
Parameters: ~
• {lang} (`string`) Language

View File

@ -139,9 +139,7 @@ function M.register(lang, filetype)
end
end
--- Inspects the provided language.
---
--- Inspecting provides some useful information on the language like node names, ...
--- Gets some useful information on the language like node names, ...
---
---@param lang string Language
---@return table

View File

@ -607,11 +607,17 @@ local function visit_node(root, level, lang_tree, headings, opt, stats)
s = fix_tab_after_conceal(s, node_text(root:next_sibling()))
end
return s
elseif vim.list_contains({ 'codespan', 'keycode' }, node_name) then
elseif vim.list_contains({ 'codespan', 'keycode', 'optional' }, node_name) then
if root:has_error() then
return text
end
local s = ('%s<code>%s</code>'):format(ws(), trimmed)
local class = node_name == 'optional' and ' class="optional"' or ''
local s = (
node_name == 'keycode'
-- TODO: use <kbd>. Currently has a layout issue, example: ":help _".
and ('%s<code>%s</code>'):format(ws(), trimmed)
or ('%s<code%s>%s</code>'):format(ws(), class, trimmed)
)
if opt.old and node_name == 'codespan' then
s = fix_tab_after_conceal(s, node_text(root:next_sibling()))
end
@ -1013,11 +1019,13 @@ local function gen_css(fname)
local css = [[
:root {
--code-color: #004b4b;
--kbd-color: red;
--tag-color: #095943;
}
@media (prefers-color-scheme: dark) {
:root {
--code-color: #00c243;
--kbd-color: red;
--tag-color: #00b7b7;
}
}
@ -1087,7 +1095,7 @@ local function gen_css(fname)
/* Tabs are used for alignment in old docs, so we must match Vim's 8-char expectation. */
tab-size: 8;
white-space: pre;
font-size: 16px;
font-size: 15px;
font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace;
}
.old-help-para pre {
@ -1146,7 +1154,14 @@ local function gen_css(fname)
}
code {
color: var(--code-color);
font-size: 16px;
font-size: 15px;
}
code.optional {
color: yellow;
}
kbd {
/* color: var(--kbd-color); */
font-size: 15px;
}
pre {
/* Tabs are used in codeblocks only for indentation, not alignment, so we can aggressively shrink them. */
@ -1155,7 +1170,7 @@ local function gen_css(fname)
line-height: 1.3; /* Important for ascii art. */
overflow: visible;
/* font-family: ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,Liberation Mono,monospace; */
font-size: 16px;
font-size: 15px;
margin-top: 10px;
}
pre:last-child {