MapComplete/src/Utils/MarkdownUtils.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
596 B
TypeScript
Raw Normal View History

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")
}
}