diff --git a/endpoints/badge.ts b/endpoints/badge.ts
index 66dce0b..f0eba88 100644
--- a/endpoints/badge.ts
+++ b/endpoints/badge.ts
@@ -12,12 +12,12 @@ export const examples = [
'/badge/code%20style/standard/f2a': 'code style: standard'
}
}, {
- title: 'Options',
+ title: 'With Options',
examples: {
'/badge/icon/github?icon=github': 'use builtin icon',
'/badge/github/github?icon': 'use builtin icon (by subject)',
'/badge/jQuery/powered?icon=https://simpleicons.now.sh/jquery/fff': 'use external icon',
- '/badge/icon/github?label=custom label': 'custom label',
+ '/badge/icon/github?label=custom%20label': 'custom label',
'/badge/icon/github?label': 'disable label',
'/badge/github/github?icon&label': 'use icon, disable label',
'/badge/platform/ios,macos,tvos?list=|': 'list (custom seprator)'
diff --git a/libs/gen-help.ts b/libs/gen-help.ts
index a900885..c7f6b29 100644
--- a/libs/gen-help.ts
+++ b/libs/gen-help.ts
@@ -10,6 +10,10 @@ export default function genHelp (id) {
return ''
}
+ if (id === 'badge') {
+ return genStaticBadgeHelp(badgeModule.examples)
+ }
+
const { meta, handlers } = badgeModule
const { examples, help = ''} = meta
const routes = Object.keys(handlers)
@@ -39,10 +43,7 @@ export default function genHelp (id) {
// category example list
// @ts-ignore
- const egList = egs.map(([url, desc]) => {
- return `-  [${url}](${url}) ${desc}`
- })
- md += egList.join('\n')
+ md += egs.map(egLine).join('\n')
})
return md
@@ -54,3 +55,17 @@ function hashify (str: string) {
// return str.replace(/[^\w]/g, '')
return str.split(/[^\w]+/).filter(Boolean).join('-')
}
+
+function egLine ([url, desc]) {
+ return `-  [${url}](${url}) ${desc}`
+}
+
+function genStaticBadgeHelp (staticExamples) {
+ let md = `# Static Badge\n\n`
+
+ md += staticExamples.map(({ title, examples }) => {
+ return `### ${title}\n\n` + Object.entries(examples).map(egLine).join('\n')
+ }).join('\n\n')
+
+ return md
+}