Skip to content

Commit

Permalink
docs: invalid <p> for route params (DIYgod#9455)
Browse files Browse the repository at this point in the history
Signed-off-by: Rongrong <[email protected]>
  • Loading branch information
Rongronggg9 authored and RikkaBlue committed Apr 9, 2022
1 parent f86f694 commit 2572813
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions docs/.vuepress/components/Route.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
<div v-if="path.match(/:.*?(\/|$)/g)">
<p>
参数:
<ul><li class="params" v-for="(item, index) in path.match(/:.*?(\/|$)/g)"><code>{{item.replace(':','').replace('/','').replace('?','')}}</code>, {{(item.includes('?'))?'可选':'必选'}} - <span v-html="renderMarkdown(paramsDesc[index])"></span></li></ul> </p>
</p>
<ul><li class="params" v-for="(item, index) in path.match(/:.*?(\/|$)/g)"><code>{{item.replace(':','').replace('/','').replace('?','')}}</code>, {{(item.includes('?'))?'可选':'必选'}} - <span v-html="renderMarkdown(paramsDesc[index])"></span></li></ul>
</div>
<div v-else><p>参数: 无</p></div>
<slot></slot>
Expand Down Expand Up @@ -70,11 +71,11 @@ export default {
},
},
methods: {
renderMarkdown(item) {
renderMarkdown(item, inline = true) {
const md = require('markdown-it')({
html: true,
});
return md.render(item);
return inline ? md.renderInline(item) : md.render(item);
},
},
computed: {
Expand Down
7 changes: 4 additions & 3 deletions docs/.vuepress/components/RouteEn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
<div v-if="path.match(/(?<=:).*?(?=\/|$)/g)">
<p>
Parameters:
<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> </p>
</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>
</div>
<div v-else><p>Parameters: N/A</p></div>
<slot></slot>
Expand Down Expand Up @@ -66,11 +67,11 @@ export default {
},
},
methods: {
renderMarkdown(item) {
renderMarkdown(item, inline = true) {
const md = require('markdown-it')({
html: true,
});
return md.render(item);
return inline ? md.renderInline(item) : md.render(item);
},
},
computed: {
Expand Down

0 comments on commit 2572813

Please sign in to comment.