 
     /// Converts an HTML Attachment into it's representing nodes.
     ///
-    func htmlAttachmentToNode(_ attachment: HTMLAttachment) -> [Node] {
+    func processHtmlAttachment(from attrString: NSAttributedString) -> [Node] {
+        guard let attachment = attrString.attribute(NSAttachmentAttributeName, at: 0, effectiveRange: nil) as? HTMLAttachment else {
+            return []
+        }
+
         let converter = Libxml2.In.HTMLConverter()
 
         let rootNode = converter.convert(attachment.rawHTML)
 
         guard let firstChild = rootNode.children.first else {
-            return textToNodes(attachment.rawHTML)
+            return processTextNodes(from: attachment.rawHTML)
         }
 
         guard rootNode.children.count == 1 else {


    /// Converts an Image Attachment into it's representing nodes.
    ///
    func imageAttachmentToNodes(_ attachment: ImageAttachment) -> [Node] {
        var attributes = [Attribute]()
        if let attribute = imageSourceAttribute(from: attachment) {
            attributes.append(attribute)


    /// Converts a String into it's representing nodes.
    ///
    func processTextNodes(from text: String) -> [Node] {
        let substrings = text.components(separatedBy: String(.newline))
        var output = [Node]()

