     name: s.substring(1)
     type: 'text'
     value: null
+    append: (prev) ->
+      if @level > prev.level
+        prev.appendChild @
+      else if @level is prev.level
+        prev.parent.appendChild @
+      else if @level < prev.level
+        p = prev
+        p = p.parent until p.level is @level
+        p.parent.appendChild @
+      @
     write: ->
       @name
 

    name: s.substring 1
    type: 'element'
    value: null
    write: ->
      attributes = (" #{k}=\"#{v}\"" for k, v of @attributes).join ''
      children = @children.map((i) -> i.write()).join('')

        name: s
        type: 'text'
        value: null
        append: (prev) ->
          if @level > prev.level
            prev.appendChild @
          else if @level is prev.level
            prev.parent.appendChild @
          else if @level < prev.level
            p = prev
            p = p.parent until p.level is @level
            p.parent.appendChild @
          @
        write: -> s
    ].some (f) ->
      parsed = f node
