forked from cadence/out-of-your-element
Fix more edge-case embed formatting
This commit is contained in:
parent
762e48230c
commit
afbbe0da3d
12 changed files with 428 additions and 127 deletions
|
@ -110,6 +110,24 @@ turndownService.addRule("inlineLink", {
|
|||
}
|
||||
})
|
||||
|
||||
turndownService.addRule("listItem", {
|
||||
filter: "li",
|
||||
replacement: function (content, node, options) {
|
||||
content = content
|
||||
.replace(/^\n+/, "") // remove leading newlines
|
||||
.replace(/\n+$/, "\n") // replace trailing newlines with just a single one
|
||||
.replace(/\n/gm, "\n ") // indent
|
||||
var prefix = options.bulletListMarker + " "
|
||||
var parent = node.parentNode
|
||||
if (parent.nodeName === "OL") {
|
||||
var start = parent.getAttribute("start")
|
||||
var index = Array.prototype.indexOf.call(parent.children, node)
|
||||
prefix = (start ? Number(start) + index : index + 1) + ". "
|
||||
}
|
||||
return prefix + content + (node.nextSibling && !/\n$/.test(content) ? "\n" : "")
|
||||
}
|
||||
})
|
||||
|
||||
/** @type {string[]} SPRITE SHEET EMOJIS FEATURE: mxc urls for the currently processing message */
|
||||
let endOfMessageEmojis = []
|
||||
turndownService.addRule("emoji", {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue