3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-23 09:35:02 +00:00
This commit is contained in:
metal 2021-09-06 14:12:48 +00:00 committed by GitHub
parent 543ccda3d3
commit 6bc975e4b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View file

@ -70,6 +70,8 @@ export const TagsPlugin = zeppelinGuildPlugin<TagsPluginType>()({
You use them by adding a \`{}\` on your tag. You use them by adding a \`{}\` on your tag.
### Available Functions ### Available Functions
Here are the functions you can use in your tags:
${generateTemplateMarkdown(TemplateFunctions)} ${generateTemplateMarkdown(TemplateFunctions)}
`), `),
}, },

View file

@ -1,19 +1,16 @@
import { TemplateFunction } from "./types"; import { TemplateFunction } from "./types";
export function generateTemplateMarkdown(definitions: TemplateFunction[]): string { export function generateTemplateMarkdown(definitions: TemplateFunction[]): string {
const table = definitions return definitions
.map(def => { .map(def => {
const argsString = def.signature ?? `(${def.arguments.join(", ")})`; const usage = def.signature ?? `(${def.arguments.join(", ")})`;
const usage = def.signature ? `| ${def.signature} |` : argsString;
const exampl = def.examples ? def.examples.map(ex => `> ${ex}`).join("\n") : ""; const exampl = def.examples ? def.examples.map(ex => `> ${ex}`).join("\n") : "";
return ` return `
#### ${def.name} #### ${def.name}
\`${usage}\` \`{${usage}}\`
**${def.description}** **${def.description}**
${exampl} ${exampl}
`; `;
}) })
.join("\n\n"); .join("\n\n");
return table;
} }