deserialize headers from html back to markdown
This commit is contained in:
parent
5565eca0cb
commit
5b54cf566d
1 changed files with 12 additions and 0 deletions
|
@ -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":
|
||||
|
|
Loading…
Reference in a new issue