deserialize headers from html back to markdown

This commit is contained in:
Bruno Windels 2019-09-02 16:23:56 +02:00
parent 5565eca0cb
commit 5b54cf566d

View File

@ -71,8 +71,20 @@ function parseCodeBlock(n, partCreator) {
return parts;
}
function parseHeader(el, partCreator) {
const depth = parseInt(el.nodeName.substr(1), 10);
return partCreator.plain("#".repeat(depth) + " ");
}
function parseElement(n, partCreator, state) {
switch (n.nodeName) {
case "H1":
case "H2":
case "H3":
case "H4":
case "H5":
case "H6":
return parseHeader(n, partCreator);
case "A":
return parseLink(n, partCreator);
case "BR":