mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 05:55:00 +08:00
deserialize headers from html back to markdown
This commit is contained in:
parent
5565eca0cb
commit
5b54cf566d
@ -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 New Issue
Block a user