docs: support parameter suffix * (#7946)

* docs: support parameter suffix `*`

`*` denotes a zero or more parameter matches, so the parameter including `*` is optional. (https://github.com/pillarjs/path-to-regexp#zero-or-more)

* docs: mention the parameter suffix `*`

* docs: support parameter suffix `+`

* docs: add document of parameter suffixs

* docs: fix having / at the end of parameter

* docs: add missing changes in en docs

* docs: typo

Co-authored-by: TonyRL <TonyRL@users.noreply.github.com>
This commit is contained in:
Hagb (Junyu Guo 郭俊余)
2022-05-07 17:18:35 +08:00
committed by GitHub
parent 2441ef91f0
commit eb79456f40
6 changed files with 11 additions and 9 deletions

View File

@@ -16,7 +16,7 @@
<p>
Parameters:
</p>
<ul><li class="params" v-for="(item, index) in path.match(/(?<=:).*?(?=\/|$)/g)"><code>{{item.replace('?','')}}</code>, {{(item.includes('?'))?'optional':'required'}} - <span v-html="renderMarkdown(paramsDesc[index])"></span></li></ul>
<ul><li class="params" v-for="(item, index) in path.match(/(?<=:).*?(?=\/|$)/g)"><code>{{item.replace(/:|\?|\+|\*/g,'')}}</code>, {{{'?':'optional','*':'zero or more','+':'one or more'}[item[item.length-1]]||'required'}} - <span v-html="renderMarkdown(paramsDesc[index])"></span></li></ul>
</div>
<div v-else><p>Parameters: N/A</p></div>
<slot></slot>