all files / packages/heading/ HeadingHTMLConverter.js

100% Statements 5/5
100% Branches 0/0
100% Functions 3/3
100% Lines 5/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22          101×       16× 16×                  
export default {
 
  type: "heading",
 
  matchElement: function(el) {
    return /^h\d$/.exec(el.tagName)
  },
 
  import: function(el, node, converter) {
    node.level = Number(el.tagName[1])
    node.content = converter.annotatedText(el, [node.id, 'content'])
  },
 
  export: function(node, el, converter) {
    el.tagName = 'h'+node.level
    el.append(
      converter.annotatedText([node.id, 'content'])
    )
  }
 
}