public static function truncateLetters($html, $limit = 0, $ellipsis = '')
    {
        if ($limit <= 0) {
            return $html;
        }

        $doc = self::htmlToDomDocument($html);
        $container = $doc->getElementsByTagName('div')->item(0);
        $container = $container->parentNode->removeChild($container);

        // Iterate over letters.
        $letters = new DOMLettersIterator($container);
        $truncated = false;
        foreach ($letters as $letter) {

            // If we have exceeded the limit, we want to delete the remainder of this document.
            if ($letters->key() >= $limit) {

                $currentText = $letters->currentTextPosition();
                $currentText[0]->nodeValue = mb_substr($currentText[0]->nodeValue, 0, $currentText[1] + 1);
                self::removeProceedingNodes($currentText[0], $container);

                if (!empty($ellipsis)) {
                    self::insertEllipsis($currentText[0], $ellipsis);
                }

                $truncated = true;

                break;
            }
        }

        // Return original HTML if not truncated.
        if ($truncated) {
            $html = self::getCleanedHtml($doc, $container);
        }

        return $html;
    }