Improve exporting markdown

This commit is contained in:
kngako
2023-01-13 21:43:17 +02:00
parent 2f14e479a0
commit f3e5337498
2 changed files with 17 additions and 4 deletions

View File

@@ -1527,7 +1527,7 @@ module.exports = function (options) {
console.log("Done processing all...") console.log("Done processing all...")
} }
response.redirect(`/project/${project.id}`) response.redirect(`/projects/${project.id}`)
} else { } else {
next() next()
} }

View File

@@ -368,11 +368,15 @@ module.exports = function (options) {
response.contentType = "text/plain" response.contentType = "text/plain"
response.send(tokens.reduce( response.send(tokens.reduce(
(accumulator, token) => { (accumulator, token) => {
if (token.type == "list_item_close" || token.type == "bullet_list_open") { if (token.type == "list_item_close") {
return accumulator return accumulator
} }
if (token.type == "bullet_list_close" ) { if (token.type == "ordered_list_open" || token.type == "bullet_list_open") {
return accumulator
}
if (token.type == "bullet_list_close" || token.type == "ordered_list_close") {
return accumulator + "\n" return accumulator + "\n"
} }
@@ -386,12 +390,21 @@ module.exports = function (options) {
} }
if (token.type == "list_item_open") { if (token.type == "list_item_open") {
return accumulator + "- " return accumulator + `${token.info}${token.markup} `
} }
if (token.type == "inline") { if (token.type == "inline") {
return accumulator + token.content return accumulator + token.content
} }
if (token.type == "heading_open") {
return `${accumulator}${token.markup} `
}
if (token.type == "heading_close") {
return `${accumulator}\n`
}
return accumulator + token.markup return accumulator + token.markup
}, },
"" ""