Format documentation comments as Markdown
parent
bc123a7788
commit
bfa05bb8bf
|
|
@ -31,7 +31,7 @@ let file = [];
|
||||||
function add(text) {
|
function add(text) {
|
||||||
if (text)
|
if (text)
|
||||||
file = file.concat(
|
file = file.concat(
|
||||||
text.split("\n").map((line) => " ".repeat(indent) + line)
|
text.split("\n").map((line) => " ".repeat(indent) + line.trimEnd())
|
||||||
);
|
);
|
||||||
else file.push("");
|
else file.push("");
|
||||||
}
|
}
|
||||||
|
|
@ -46,7 +46,24 @@ function get(key, obj, isGlobal) {
|
||||||
(obj["!doc"] || "")
|
(obj["!doc"] || "")
|
||||||
.split("\n")
|
.split("\n")
|
||||||
.filter((line) => line)
|
.filter((line) => line)
|
||||||
.map((line) => line.replace(/^<p>(.*)<\/p>$/, "$1"))
|
.map((line) =>
|
||||||
|
line
|
||||||
|
.replace("<p>", "")
|
||||||
|
.replace("</p>", "")
|
||||||
|
.replace(/'/g, "'")
|
||||||
|
.replace(/"/g, '"')
|
||||||
|
.replace(/>/g, ">")
|
||||||
|
.replace(/</g, "<")
|
||||||
|
.replace(/&/g, "&")
|
||||||
|
.replace(/°/g, "°")
|
||||||
|
.replace(/<\/?strong>/g, "**")
|
||||||
|
.replace(/<\/?em>/g, "*")
|
||||||
|
.replace(/<\/?code>/g, "`")
|
||||||
|
.replace(/<\/?ul>/g, "")
|
||||||
|
.replace(/<li>/g, "- ")
|
||||||
|
.replace(/<\/li>/g, "")
|
||||||
|
.replace(/<a href="([^\n]*)">([^\n]*)<\/a>/g, "[$2]($1)")
|
||||||
|
)
|
||||||
.concat([`@url ${obj["!url"]}`])
|
.concat([`@url ${obj["!url"]}`])
|
||||||
.map((line) => " * " + line)
|
.map((line) => " * " + line)
|
||||||
.join("\n") +
|
.join("\n") +
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue