                 output.append(newline)
             }
 
-            let text = TextNode(text: substring)
-            output.append(text)
+            let node = TextNode(text: substring)
+            output.append(node)
         }
         
         return output

    ///
    func createLeafNodes(from attrString: NSAttributedString) -> [Node] {
        let attachment = attrString.attribute(NSAttachmentAttributeName, at: 0, effectiveRange: nil) as? NSTextAttachment
        var leafs = [Node]()

        switch attachment {
        case let lineAttachment as LineAttachment:
            let node = lineAttachmentToNode(lineAttachment)
            leafs.append(node)
        case let commentAttachment as CommentAttachment:
            let node = commentAttachmentToNode(commentAttachment)
            leafs.append(node)
        case let htmlAttachment as HTMLAttachment:
            let nodes = htmlAttachmentToNode(htmlAttachment)
            leafs.append(contentsOf: nodes)
        case let imageAttachment as ImageAttachment:
            let node = imageAttachmentToNode(imageAttachment)
            leafs.append(node)
        default:
            let nodes = textToNode(attrString.string)
            leafs.append(contentsOf: nodes)
        }

        return leafs
    }
}



    ///
    ///
    func imageAttachmentToNodes(_ attachment: ImageAttachment) -> [Node] {
        var attributes = [Attribute]()
        if let source = attachment.url?.absoluteString {
            let attribute = StringAttribute(name: "src", value: source)
            attributes.append(attribute)
        }

        let node = ElementNode(type: .img, attributes: attributes)
        return [node]
    }


    ///
    ///
    func textToNodes(_ text: String) -> [Node] {
        let substrings = text.components(separatedBy: String(.newline))
        var output = [Node]()

