forked from MapComplete/MapComplete
20 lines
605 B
TypeScript
20 lines
605 B
TypeScript
export default class MarkdownUtils {
|
|
public static table(header: string[], contents: string[][]) {
|
|
let result = ""
|
|
|
|
result += "\n\n| " + header.join(" | ") + " |\n"
|
|
result += header.map(() => "-----").join("|") + " |\n"
|
|
for (const line of contents) {
|
|
if (!line) {
|
|
continue
|
|
}
|
|
result += "| " + line.map((x) => x ?? "").join(" | ") + " |\n"
|
|
}
|
|
result += "\n\n"
|
|
return result
|
|
}
|
|
|
|
static list(strings: string[]): string {
|
|
return strings.map((item) => " - " + item).join("\n")
|
|
}
|
|
}
|