[
  {
    "path": ".gitattributes",
    "content": "# Ignore all tests for archive\n/test               export-ignore\n/.gitattributes     export-ignore\n/.gitignore         export-ignore\n/.travis.yml        export-ignore\n/phpunit.xml.dist   export-ignore\n"
  },
  {
    "path": ".github/workflows/unit-tests.yaml",
    "content": "on:\n    - push\n    - pull_request\n\njobs:\n    phpunit:\n        runs-on: ubuntu-latest\n\n        strategy:\n            matrix:\n                php:\n                    - '7.2'\n                    - '7.3'\n                    - '7.4'\n                    - '8.0'\n                    - '8.1'\n                    - '8.2'\n                    - '8.3'\n                    - '8.4'\n\n        steps:\n            - name: Checkout the source code\n              uses: actions/checkout@v4\n\n            - name: Set up PHP\n              uses: shivammathur/setup-php@v2\n              with:\n                  php-version: '${{ matrix.php }}'\n\n            - name: Install dependencies\n              run: composer install\n\n            - name: Run tests\n              run: |\n                  vendor/bin/phpunit\n                  vendor/bin/phpunit test/CommonMarkTestWeak.php || true\n"
  },
  {
    "path": ".gitignore",
    "content": "*.md\n!readme.md\n\ncomposer.lock\nvendor/\n.phpunit.result.cache\n"
  },
  {
    "path": "LICENSE.txt",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2013-2018 Emanuil Rusev, erusev.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "Parsedown.php",
    "content": "<?php\n\n#\n#\n# Parsedown\n# http://parsedown.org\n#\n# (c) Emanuil Rusev\n# http://erusev.com\n#\n# For the full license information, view the LICENSE file that was distributed\n# with this source code.\n#\n#\n\nclass Parsedown\n{\n    # ~\n\n    const version = '1.8.0';\n\n    # ~\n\n    function text($text)\n    {\n        $Elements = $this->textElements($text);\n\n        # convert to markup\n        $markup = $this->elements($Elements);\n\n        # trim line breaks\n        $markup = trim($markup, \"\\n\");\n\n        return $markup;\n    }\n\n    protected function textElements($text)\n    {\n        # make sure no definitions are set\n        $this->DefinitionData = array();\n\n        # standardize line breaks\n        $text = str_replace(array(\"\\r\\n\", \"\\r\"), \"\\n\", $text);\n\n        # remove surrounding line breaks\n        $text = trim($text, \"\\n\");\n\n        # split text into lines\n        $lines = explode(\"\\n\", $text);\n\n        # iterate through lines to identify blocks\n        return $this->linesElements($lines);\n    }\n\n    #\n    # Setters\n    #\n\n    function setBreaksEnabled($breaksEnabled)\n    {\n        $this->breaksEnabled = $breaksEnabled;\n\n        return $this;\n    }\n\n    protected $breaksEnabled;\n\n    function setMarkupEscaped($markupEscaped)\n    {\n        $this->markupEscaped = $markupEscaped;\n\n        return $this;\n    }\n\n    protected $markupEscaped;\n\n    function setUrlsLinked($urlsLinked)\n    {\n        $this->urlsLinked = $urlsLinked;\n\n        return $this;\n    }\n\n    protected $urlsLinked = true;\n\n    function setSafeMode($safeMode)\n    {\n        $this->safeMode = (bool) $safeMode;\n\n        return $this;\n    }\n\n    protected $safeMode;\n\n    function setStrictMode($strictMode)\n    {\n        $this->strictMode = (bool) $strictMode;\n\n        return $this;\n    }\n\n    protected $strictMode;\n\n    protected $safeLinksWhitelist = array(\n        'http://',\n        'https://',\n        'ftp://',\n        'ftps://',\n        'mailto:',\n        'tel:',\n        'data:image/png;base64,',\n        'data:image/gif;base64,',\n        'data:image/jpeg;base64,',\n        'irc:',\n        'ircs:',\n        'git:',\n        'ssh:',\n        'news:',\n        'steam:',\n    );\n\n    #\n    # Lines\n    #\n\n    protected $BlockTypes = array(\n        '#' => array('Header'),\n        '*' => array('Rule', 'List'),\n        '+' => array('List'),\n        '-' => array('SetextHeader', 'Table', 'Rule', 'List'),\n        '0' => array('List'),\n        '1' => array('List'),\n        '2' => array('List'),\n        '3' => array('List'),\n        '4' => array('List'),\n        '5' => array('List'),\n        '6' => array('List'),\n        '7' => array('List'),\n        '8' => array('List'),\n        '9' => array('List'),\n        ':' => array('Table'),\n        '<' => array('Comment', 'Markup'),\n        '=' => array('SetextHeader'),\n        '>' => array('Quote'),\n        '[' => array('Reference'),\n        '_' => array('Rule'),\n        '`' => array('FencedCode'),\n        '|' => array('Table'),\n        '~' => array('FencedCode'),\n    );\n\n    # ~\n\n    protected $unmarkedBlockTypes = array(\n        'Code',\n    );\n\n    #\n    # Blocks\n    #\n\n    protected function lines(array $lines)\n    {\n        return $this->elements($this->linesElements($lines));\n    }\n\n    protected function linesElements(array $lines)\n    {\n        $Elements = array();\n        $CurrentBlock = null;\n\n        foreach ($lines as $line)\n        {\n            if (chop($line) === '')\n            {\n                if (isset($CurrentBlock))\n                {\n                    $CurrentBlock['interrupted'] = (isset($CurrentBlock['interrupted'])\n                        ? $CurrentBlock['interrupted'] + 1 : 1\n                    );\n                }\n\n                continue;\n            }\n\n            while (($beforeTab = strstr($line, \"\\t\", true)) !== false)\n            {\n                $shortage = 4 - mb_strlen($beforeTab, 'utf-8') % 4;\n\n                $line = $beforeTab\n                    . str_repeat(' ', $shortage)\n                    . substr($line, strlen($beforeTab) + 1)\n                ;\n            }\n\n            $indent = strspn($line, ' ');\n\n            $text = $indent > 0 ? substr($line, $indent) : $line;\n\n            # ~\n\n            $Line = array('body' => $line, 'indent' => $indent, 'text' => $text);\n\n            # ~\n\n            if (isset($CurrentBlock['continuable']))\n            {\n                $methodName = 'block' . $CurrentBlock['type'] . 'Continue';\n                $Block = $this->$methodName($Line, $CurrentBlock);\n\n                if (isset($Block))\n                {\n                    $CurrentBlock = $Block;\n\n                    continue;\n                }\n                else\n                {\n                    if ($this->isBlockCompletable($CurrentBlock['type']))\n                    {\n                        $methodName = 'block' . $CurrentBlock['type'] . 'Complete';\n                        $CurrentBlock = $this->$methodName($CurrentBlock);\n                    }\n                }\n            }\n\n            # ~\n\n            $marker = $text[0];\n\n            # ~\n\n            $blockTypes = $this->unmarkedBlockTypes;\n\n            if (isset($this->BlockTypes[$marker]))\n            {\n                foreach ($this->BlockTypes[$marker] as $blockType)\n                {\n                    $blockTypes []= $blockType;\n                }\n            }\n\n            #\n            # ~\n\n            foreach ($blockTypes as $blockType)\n            {\n                $Block = $this->{\"block$blockType\"}($Line, $CurrentBlock);\n\n                if (isset($Block))\n                {\n                    $Block['type'] = $blockType;\n\n                    if ( ! isset($Block['identified']))\n                    {\n                        if (isset($CurrentBlock))\n                        {\n                            $Elements[] = $this->extractElement($CurrentBlock);\n                        }\n\n                        $Block['identified'] = true;\n                    }\n\n                    if ($this->isBlockContinuable($blockType))\n                    {\n                        $Block['continuable'] = true;\n                    }\n\n                    $CurrentBlock = $Block;\n\n                    continue 2;\n                }\n            }\n\n            # ~\n\n            if (isset($CurrentBlock) and $CurrentBlock['type'] === 'Paragraph')\n            {\n                $Block = $this->paragraphContinue($Line, $CurrentBlock);\n            }\n\n            if (isset($Block))\n            {\n                $CurrentBlock = $Block;\n            }\n            else\n            {\n                if (isset($CurrentBlock))\n                {\n                    $Elements[] = $this->extractElement($CurrentBlock);\n                }\n\n                $CurrentBlock = $this->paragraph($Line);\n\n                $CurrentBlock['identified'] = true;\n            }\n        }\n\n        # ~\n\n        if (isset($CurrentBlock['continuable']) and $this->isBlockCompletable($CurrentBlock['type']))\n        {\n            $methodName = 'block' . $CurrentBlock['type'] . 'Complete';\n            $CurrentBlock = $this->$methodName($CurrentBlock);\n        }\n\n        # ~\n\n        if (isset($CurrentBlock))\n        {\n            $Elements[] = $this->extractElement($CurrentBlock);\n        }\n\n        # ~\n\n        return $Elements;\n    }\n\n    protected function extractElement(array $Component)\n    {\n        if ( ! isset($Component['element']))\n        {\n            if (isset($Component['markup']))\n            {\n                $Component['element'] = array('rawHtml' => $Component['markup']);\n            }\n            elseif (isset($Component['hidden']))\n            {\n                $Component['element'] = array();\n            }\n        }\n\n        return $Component['element'];\n    }\n\n    protected function isBlockContinuable($Type)\n    {\n        return method_exists($this, 'block' . $Type . 'Continue');\n    }\n\n    protected function isBlockCompletable($Type)\n    {\n        return method_exists($this, 'block' . $Type . 'Complete');\n    }\n\n    #\n    # Code\n\n    protected function blockCode($Line, $Block = null)\n    {\n        if (isset($Block) and $Block['type'] === 'Paragraph' and ! isset($Block['interrupted']))\n        {\n            return;\n        }\n\n        if ($Line['indent'] >= 4)\n        {\n            $text = substr($Line['body'], 4);\n\n            $Block = array(\n                'element' => array(\n                    'name' => 'pre',\n                    'element' => array(\n                        'name' => 'code',\n                        'text' => $text,\n                    ),\n                ),\n            );\n\n            return $Block;\n        }\n    }\n\n    protected function blockCodeContinue($Line, $Block)\n    {\n        if ($Line['indent'] >= 4)\n        {\n            if (isset($Block['interrupted']))\n            {\n                $Block['element']['element']['text'] .= str_repeat(\"\\n\", $Block['interrupted']);\n\n                unset($Block['interrupted']);\n            }\n\n            $Block['element']['element']['text'] .= \"\\n\";\n\n            $text = substr($Line['body'], 4);\n\n            $Block['element']['element']['text'] .= $text;\n\n            return $Block;\n        }\n    }\n\n    protected function blockCodeComplete($Block)\n    {\n        return $Block;\n    }\n\n    #\n    # Comment\n\n    protected function blockComment($Line)\n    {\n        if ($this->markupEscaped or $this->safeMode)\n        {\n            return;\n        }\n\n        if (strpos($Line['text'], '<!--') === 0)\n        {\n            $Block = array(\n                'element' => array(\n                    'rawHtml' => $Line['body'],\n                    'autobreak' => true,\n                ),\n            );\n\n            if (strpos($Line['text'], '-->') !== false)\n            {\n                $Block['closed'] = true;\n            }\n\n            return $Block;\n        }\n    }\n\n    protected function blockCommentContinue($Line, array $Block)\n    {\n        if (isset($Block['closed']))\n        {\n            return;\n        }\n\n        $Block['element']['rawHtml'] .= \"\\n\" . $Line['body'];\n\n        if (strpos($Line['text'], '-->') !== false)\n        {\n            $Block['closed'] = true;\n        }\n\n        return $Block;\n    }\n\n    #\n    # Fenced Code\n\n    protected function blockFencedCode($Line)\n    {\n        $marker = $Line['text'][0];\n\n        $openerLength = strspn($Line['text'], $marker);\n\n        if ($openerLength < 3)\n        {\n            return;\n        }\n\n        $infostring = trim(substr($Line['text'], $openerLength), \"\\t \");\n\n        if (strpos($infostring, '`') !== false)\n        {\n            return;\n        }\n\n        $Element = array(\n            'name' => 'code',\n            'text' => '',\n        );\n\n        if ($infostring !== '')\n        {\n            /**\n             * https://www.w3.org/TR/2011/WD-html5-20110525/elements.html#classes\n             * Every HTML element may have a class attribute specified.\n             * The attribute, if specified, must have a value that is a set\n             * of space-separated tokens representing the various classes\n             * that the element belongs to.\n             * [...]\n             * The space characters, for the purposes of this specification,\n             * are U+0020 SPACE, U+0009 CHARACTER TABULATION (tab),\n             * U+000A LINE FEED (LF), U+000C FORM FEED (FF), and\n             * U+000D CARRIAGE RETURN (CR).\n             */\n            $language = substr($infostring, 0, strcspn($infostring, \" \\t\\n\\f\\r\"));\n\n            $Element['attributes'] = array('class' => \"language-$language\");\n        }\n\n        $Block = array(\n            'char' => $marker,\n            'openerLength' => $openerLength,\n            'element' => array(\n                'name' => 'pre',\n                'element' => $Element,\n            ),\n        );\n\n        return $Block;\n    }\n\n    protected function blockFencedCodeContinue($Line, $Block)\n    {\n        if (isset($Block['complete']))\n        {\n            return;\n        }\n\n        if (isset($Block['interrupted']))\n        {\n            $Block['element']['element']['text'] .= str_repeat(\"\\n\", $Block['interrupted']);\n\n            unset($Block['interrupted']);\n        }\n\n        if (($len = strspn($Line['text'], $Block['char'])) >= $Block['openerLength']\n            and chop(substr($Line['text'], $len), ' ') === ''\n        ) {\n            $Block['element']['element']['text'] = substr($Block['element']['element']['text'], 1);\n\n            $Block['complete'] = true;\n\n            return $Block;\n        }\n\n        $Block['element']['element']['text'] .= \"\\n\" . $Line['body'];\n\n        return $Block;\n    }\n\n    protected function blockFencedCodeComplete($Block)\n    {\n        return $Block;\n    }\n\n    #\n    # Header\n\n    protected function blockHeader($Line)\n    {\n        $level = strspn($Line['text'], '#');\n\n        if ($level > 6)\n        {\n            return;\n        }\n\n        $text = trim($Line['text'], '#');\n\n        if ($this->strictMode and isset($text[0]) and $text[0] !== ' ')\n        {\n            return;\n        }\n\n        $text = trim($text, ' ');\n\n        $Block = array(\n            'element' => array(\n                'name' => 'h' . $level,\n                'handler' => array(\n                    'function' => 'lineElements',\n                    'argument' => $text,\n                    'destination' => 'elements',\n                )\n            ),\n        );\n\n        return $Block;\n    }\n\n    #\n    # List\n\n    protected function blockList($Line, ?array $CurrentBlock = null)\n    {\n        list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]{1,9}+[.\\)]');\n\n        if (preg_match('/^('.$pattern.'([ ]++|$))(.*+)/', $Line['text'], $matches))\n        {\n            $contentIndent = strlen($matches[2]);\n\n            if ($contentIndent >= 5)\n            {\n                $contentIndent -= 1;\n                $matches[1] = substr($matches[1], 0, -$contentIndent);\n                $matches[3] = str_repeat(' ', $contentIndent) . $matches[3];\n            }\n            elseif ($contentIndent === 0)\n            {\n                $matches[1] .= ' ';\n            }\n\n            $markerWithoutWhitespace = strstr($matches[1], ' ', true);\n\n            $Block = array(\n                'indent' => $Line['indent'],\n                'pattern' => $pattern,\n                'data' => array(\n                    'type' => $name,\n                    'marker' => $matches[1],\n                    'markerType' => ($name === 'ul' ? $markerWithoutWhitespace : substr($markerWithoutWhitespace, -1)),\n                ),\n                'element' => array(\n                    'name' => $name,\n                    'elements' => array(),\n                ),\n            );\n            $Block['data']['markerTypeRegex'] = preg_quote($Block['data']['markerType'], '/');\n\n            if ($name === 'ol')\n            {\n                $listStart = ltrim(strstr($matches[1], $Block['data']['markerType'], true), '0') ?: '0';\n\n                if ($listStart !== '1')\n                {\n                    if (\n                        isset($CurrentBlock)\n                        and $CurrentBlock['type'] === 'Paragraph'\n                        and ! isset($CurrentBlock['interrupted'])\n                    ) {\n                        return;\n                    }\n\n                    $Block['element']['attributes'] = array('start' => $listStart);\n                }\n            }\n\n            $Block['li'] = array(\n                'name' => 'li',\n                'handler' => array(\n                    'function' => 'li',\n                    'argument' => !empty($matches[3]) ? array($matches[3]) : array(),\n                    'destination' => 'elements'\n                )\n            );\n\n            $Block['element']['elements'] []= & $Block['li'];\n\n            return $Block;\n        }\n    }\n\n    protected function blockListContinue($Line, array $Block)\n    {\n        if (isset($Block['interrupted']) and empty($Block['li']['handler']['argument']))\n        {\n            return null;\n        }\n\n        $requiredIndent = ($Block['indent'] + strlen($Block['data']['marker']));\n\n        if ($Line['indent'] < $requiredIndent\n            and (\n                (\n                    $Block['data']['type'] === 'ol'\n                    and preg_match('/^[0-9]++'.$Block['data']['markerTypeRegex'].'(?:[ ]++(.*)|$)/', $Line['text'], $matches)\n                ) or (\n                    $Block['data']['type'] === 'ul'\n                    and preg_match('/^'.$Block['data']['markerTypeRegex'].'(?:[ ]++(.*)|$)/', $Line['text'], $matches)\n                )\n            )\n        ) {\n            if (isset($Block['interrupted']))\n            {\n                $Block['li']['handler']['argument'] []= '';\n\n                $Block['loose'] = true;\n\n                unset($Block['interrupted']);\n            }\n\n            unset($Block['li']);\n\n            $text = isset($matches[1]) ? $matches[1] : '';\n\n            $Block['indent'] = $Line['indent'];\n\n            $Block['li'] = array(\n                'name' => 'li',\n                'handler' => array(\n                    'function' => 'li',\n                    'argument' => array($text),\n                    'destination' => 'elements'\n                )\n            );\n\n            $Block['element']['elements'] []= & $Block['li'];\n\n            return $Block;\n        }\n        elseif ($Line['indent'] < $requiredIndent and $this->blockList($Line))\n        {\n            return null;\n        }\n\n        if ($Line['text'][0] === '[' and $this->blockReference($Line))\n        {\n            return $Block;\n        }\n\n        if ($Line['indent'] >= $requiredIndent)\n        {\n            if (isset($Block['interrupted']))\n            {\n                $Block['li']['handler']['argument'] []= '';\n\n                $Block['loose'] = true;\n\n                unset($Block['interrupted']);\n            }\n\n            $text = substr($Line['body'], $requiredIndent);\n\n            $Block['li']['handler']['argument'] []= $text;\n\n            return $Block;\n        }\n\n        if ( ! isset($Block['interrupted']))\n        {\n            $text = preg_replace('/^[ ]{0,'.$requiredIndent.'}+/', '', $Line['body']);\n\n            $Block['li']['handler']['argument'] []= $text;\n\n            return $Block;\n        }\n    }\n\n    protected function blockListComplete(array $Block)\n    {\n        if (isset($Block['loose']))\n        {\n            foreach ($Block['element']['elements'] as &$li)\n            {\n                if (end($li['handler']['argument']) !== '')\n                {\n                    $li['handler']['argument'] []= '';\n                }\n            }\n        }\n\n        return $Block;\n    }\n\n    #\n    # Quote\n\n    protected function blockQuote($Line)\n    {\n        if (preg_match('/^>[ ]?+(.*+)/', $Line['text'], $matches))\n        {\n            $Block = array(\n                'element' => array(\n                    'name' => 'blockquote',\n                    'handler' => array(\n                        'function' => 'linesElements',\n                        'argument' => (array) $matches[1],\n                        'destination' => 'elements',\n                    )\n                ),\n            );\n\n            return $Block;\n        }\n    }\n\n    protected function blockQuoteContinue($Line, array $Block)\n    {\n        if (isset($Block['interrupted']))\n        {\n            return;\n        }\n\n        if ($Line['text'][0] === '>' and preg_match('/^>[ ]?+(.*+)/', $Line['text'], $matches))\n        {\n            $Block['element']['handler']['argument'] []= $matches[1];\n\n            return $Block;\n        }\n\n        if ( ! isset($Block['interrupted']))\n        {\n            $Block['element']['handler']['argument'] []= $Line['text'];\n\n            return $Block;\n        }\n    }\n\n    #\n    # Rule\n\n    protected function blockRule($Line)\n    {\n        $marker = $Line['text'][0];\n\n        if (substr_count($Line['text'], $marker) >= 3 and chop($Line['text'], \" $marker\") === '')\n        {\n            $Block = array(\n                'element' => array(\n                    'name' => 'hr',\n                ),\n            );\n\n            return $Block;\n        }\n    }\n\n    #\n    # Setext\n\n    protected function blockSetextHeader($Line, ?array $Block = null)\n    {\n        if ( ! isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted']))\n        {\n            return;\n        }\n\n        if ($Line['indent'] < 4 and chop(chop($Line['text'], ' '), $Line['text'][0]) === '')\n        {\n            $Block['element']['name'] = $Line['text'][0] === '=' ? 'h1' : 'h2';\n\n            return $Block;\n        }\n    }\n\n    #\n    # Markup\n\n    protected function blockMarkup($Line)\n    {\n        if ($this->markupEscaped or $this->safeMode)\n        {\n            return;\n        }\n\n        if (preg_match('/^<[\\/]?+(\\w*)(?:[ ]*+'.$this->regexHtmlAttribute.')*+[ ]*+(\\/)?>/', $Line['text'], $matches))\n        {\n            $element = strtolower($matches[1]);\n\n            if (in_array($element, $this->textLevelElements))\n            {\n                return;\n            }\n\n            $Block = array(\n                'name' => $matches[1],\n                'element' => array(\n                    'rawHtml' => $Line['text'],\n                    'autobreak' => true,\n                ),\n            );\n\n            return $Block;\n        }\n    }\n\n    protected function blockMarkupContinue($Line, array $Block)\n    {\n        if (isset($Block['closed']) or isset($Block['interrupted']))\n        {\n            return;\n        }\n\n        $Block['element']['rawHtml'] .= \"\\n\" . $Line['body'];\n\n        return $Block;\n    }\n\n    #\n    # Reference\n\n    protected function blockReference($Line)\n    {\n        if (strpos($Line['text'], ']') !== false\n            and preg_match('/^\\[(.+?)\\]:[ ]*+<?(\\S+?)>?(?:[ ]+[\"\\'(](.+)[\"\\')])?[ ]*+$/', $Line['text'], $matches)\n        ) {\n            $id = strtolower($matches[1]);\n\n            $Data = array(\n                'url' => $matches[2],\n                'title' => isset($matches[3]) ? $matches[3] : null,\n            );\n\n            $this->DefinitionData['Reference'][$id] = $Data;\n\n            $Block = array(\n                'element' => array(),\n            );\n\n            return $Block;\n        }\n    }\n\n    #\n    # Table\n\n    protected function blockTable($Line, ?array $Block = null)\n    {\n        if ( ! isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted']))\n        {\n            return;\n        }\n\n        if (\n            strpos($Block['element']['handler']['argument'], '|') === false\n            and strpos($Line['text'], '|') === false\n            and strpos($Line['text'], ':') === false\n            or strpos($Block['element']['handler']['argument'], \"\\n\") !== false\n        ) {\n            return;\n        }\n\n        if (chop($Line['text'], ' -:|') !== '')\n        {\n            return;\n        }\n\n        $alignments = array();\n\n        $divider = $Line['text'];\n\n        $divider = trim($divider);\n        $divider = trim($divider, '|');\n\n        $dividerCells = explode('|', $divider);\n\n        foreach ($dividerCells as $dividerCell)\n        {\n            $dividerCell = trim($dividerCell);\n\n            if ($dividerCell === '')\n            {\n                return;\n            }\n\n            $alignment = null;\n\n            if ($dividerCell[0] === ':')\n            {\n                $alignment = 'left';\n            }\n\n            if (substr($dividerCell, - 1) === ':')\n            {\n                $alignment = $alignment === 'left' ? 'center' : 'right';\n            }\n\n            $alignments []= $alignment;\n        }\n\n        # ~\n\n        $HeaderElements = array();\n\n        $header = $Block['element']['handler']['argument'];\n\n        $header = trim($header);\n        $header = trim($header, '|');\n\n        $headerCells = explode('|', $header);\n\n        if (count($headerCells) !== count($alignments))\n        {\n            return;\n        }\n\n        foreach ($headerCells as $index => $headerCell)\n        {\n            $headerCell = trim($headerCell);\n\n            $HeaderElement = array(\n                'name' => 'th',\n                'handler' => array(\n                    'function' => 'lineElements',\n                    'argument' => $headerCell,\n                    'destination' => 'elements',\n                )\n            );\n\n            if (isset($alignments[$index]))\n            {\n                $alignment = $alignments[$index];\n\n                $HeaderElement['attributes'] = array(\n                    'style' => \"text-align: $alignment;\",\n                );\n            }\n\n            $HeaderElements []= $HeaderElement;\n        }\n\n        # ~\n\n        $Block = array(\n            'alignments' => $alignments,\n            'identified' => true,\n            'element' => array(\n                'name' => 'table',\n                'elements' => array(),\n            ),\n        );\n\n        $Block['element']['elements'] []= array(\n            'name' => 'thead',\n        );\n\n        $Block['element']['elements'] []= array(\n            'name' => 'tbody',\n            'elements' => array(),\n        );\n\n        $Block['element']['elements'][0]['elements'] []= array(\n            'name' => 'tr',\n            'elements' => $HeaderElements,\n        );\n\n        return $Block;\n    }\n\n    protected function blockTableContinue($Line, array $Block)\n    {\n        if (isset($Block['interrupted']))\n        {\n            return;\n        }\n\n        if (count($Block['alignments']) === 1 or $Line['text'][0] === '|' or strpos($Line['text'], '|'))\n        {\n            $Elements = array();\n\n            $row = $Line['text'];\n\n            $row = trim($row);\n            $row = trim($row, '|');\n\n            preg_match_all('/(?:(\\\\\\\\[|])|[^|`]|`[^`]++`|`)++/', $row, $matches);\n\n            $cells = array_slice($matches[0], 0, count($Block['alignments']));\n\n            foreach ($cells as $index => $cell)\n            {\n                $cell = trim($cell);\n\n                $Element = array(\n                    'name' => 'td',\n                    'handler' => array(\n                        'function' => 'lineElements',\n                        'argument' => $cell,\n                        'destination' => 'elements',\n                    )\n                );\n\n                if (isset($Block['alignments'][$index]))\n                {\n                    $Element['attributes'] = array(\n                        'style' => 'text-align: ' . $Block['alignments'][$index] . ';',\n                    );\n                }\n\n                $Elements []= $Element;\n            }\n\n            $Element = array(\n                'name' => 'tr',\n                'elements' => $Elements,\n            );\n\n            $Block['element']['elements'][1]['elements'] []= $Element;\n\n            return $Block;\n        }\n    }\n\n    #\n    # ~\n    #\n\n    protected function paragraph($Line)\n    {\n        return array(\n            'type' => 'Paragraph',\n            'element' => array(\n                'name' => 'p',\n                'handler' => array(\n                    'function' => 'lineElements',\n                    'argument' => $Line['text'],\n                    'destination' => 'elements',\n                ),\n            ),\n        );\n    }\n\n    protected function paragraphContinue($Line, array $Block)\n    {\n        if (isset($Block['interrupted']))\n        {\n            return;\n        }\n\n        $Block['element']['handler']['argument'] .= \"\\n\".$Line['text'];\n\n        return $Block;\n    }\n\n    #\n    # Inline Elements\n    #\n\n    protected $InlineTypes = array(\n        '!' => array('Image'),\n        '&' => array('SpecialCharacter'),\n        '*' => array('Emphasis'),\n        ':' => array('Url'),\n        '<' => array('UrlTag', 'EmailTag', 'Markup'),\n        '[' => array('Link'),\n        '_' => array('Emphasis'),\n        '`' => array('Code'),\n        '~' => array('Strikethrough'),\n        '\\\\' => array('EscapeSequence'),\n    );\n\n    # ~\n\n    protected $inlineMarkerList = '!*_&[:<`~\\\\';\n\n    #\n    # ~\n    #\n\n    public function line($text, $nonNestables = array())\n    {\n        return $this->elements($this->lineElements($text, $nonNestables));\n    }\n\n    protected function lineElements($text, $nonNestables = array())\n    {\n        # standardize line breaks\n        $text = str_replace(array(\"\\r\\n\", \"\\r\"), \"\\n\", $text);\n\n        $Elements = array();\n\n        $nonNestables = (empty($nonNestables)\n            ? array()\n            : array_combine($nonNestables, $nonNestables)\n        );\n\n        # $excerpt is based on the first occurrence of a marker\n\n        while ($excerpt = strpbrk($text, $this->inlineMarkerList))\n        {\n            $marker = $excerpt[0];\n\n            $markerPosition = strlen($text) - strlen($excerpt);\n\n            $Excerpt = array('text' => $excerpt, 'context' => $text);\n\n            foreach ($this->InlineTypes[$marker] as $inlineType)\n            {\n                # check to see if the current inline type is nestable in the current context\n\n                if (isset($nonNestables[$inlineType]))\n                {\n                    continue;\n                }\n\n                $Inline = $this->{\"inline$inlineType\"}($Excerpt);\n\n                if ( ! isset($Inline))\n                {\n                    continue;\n                }\n\n                # makes sure that the inline belongs to \"our\" marker\n\n                if (isset($Inline['position']) and $Inline['position'] > $markerPosition)\n                {\n                    continue;\n                }\n\n                # sets a default inline position\n\n                if ( ! isset($Inline['position']))\n                {\n                    $Inline['position'] = $markerPosition;\n                }\n\n                # cause the new element to 'inherit' our non nestables\n\n\n                $Inline['element']['nonNestables'] = isset($Inline['element']['nonNestables'])\n                    ? array_merge($Inline['element']['nonNestables'], $nonNestables)\n                    : $nonNestables\n                ;\n\n                # the text that comes before the inline\n                $unmarkedText = substr($text, 0, $Inline['position']);\n\n                # compile the unmarked text\n                $InlineText = $this->inlineText($unmarkedText);\n                $Elements[] = $InlineText['element'];\n\n                # compile the inline\n                $Elements[] = $this->extractElement($Inline);\n\n                # remove the examined text\n                $text = substr($text, $Inline['position'] + $Inline['extent']);\n\n                continue 2;\n            }\n\n            # the marker does not belong to an inline\n\n            $unmarkedText = substr($text, 0, $markerPosition + 1);\n\n            $InlineText = $this->inlineText($unmarkedText);\n            $Elements[] = $InlineText['element'];\n\n            $text = substr($text, $markerPosition + 1);\n        }\n\n        $InlineText = $this->inlineText($text);\n        $Elements[] = $InlineText['element'];\n\n        foreach ($Elements as &$Element)\n        {\n            if ( ! isset($Element['autobreak']))\n            {\n                $Element['autobreak'] = false;\n            }\n        }\n\n        return $Elements;\n    }\n\n    #\n    # ~\n    #\n\n    protected function inlineText($text)\n    {\n        $Inline = array(\n            'extent' => strlen($text),\n            'element' => array(),\n        );\n\n        $Inline['element']['elements'] = self::pregReplaceElements(\n            $this->breaksEnabled ? '/[ ]*+\\n/' : '/(?:[ ]*+\\\\\\\\|[ ]{2,}+)\\n/',\n            array(\n                array('name' => 'br'),\n                array('text' => \"\\n\"),\n            ),\n            $text\n        );\n\n        return $Inline;\n    }\n\n    protected function inlineCode($Excerpt)\n    {\n        $marker = $Excerpt['text'][0];\n\n        if (preg_match('/^(['.$marker.']++)[ ]*+(.+?)[ ]*+(?<!['.$marker.'])\\1(?!'.$marker.')/s', $Excerpt['text'], $matches))\n        {\n            $text = $matches[2];\n            $text = preg_replace('/[ ]*+\\n/', ' ', $text);\n\n            return array(\n                'extent' => strlen($matches[0]),\n                'element' => array(\n                    'name' => 'code',\n                    'text' => $text,\n                ),\n            );\n        }\n    }\n\n    protected function inlineEmailTag($Excerpt)\n    {\n        $hostnameLabel = '[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?';\n\n        $commonMarkEmail = '[a-zA-Z0-9.!#$%&\\'*+\\/=?^_`{|}~-]++@'\n            . $hostnameLabel . '(?:\\.' . $hostnameLabel . ')*';\n\n        if (strpos($Excerpt['text'], '>') !== false\n            and preg_match(\"/^<((mailto:)?$commonMarkEmail)>/i\", $Excerpt['text'], $matches)\n        ){\n            $url = $matches[1];\n\n            if ( ! isset($matches[2]))\n            {\n                $url = \"mailto:$url\";\n            }\n\n            return array(\n                'extent' => strlen($matches[0]),\n                'element' => array(\n                    'name' => 'a',\n                    'text' => $matches[1],\n                    'attributes' => array(\n                        'href' => $url,\n                    ),\n                ),\n            );\n        }\n    }\n\n    protected function inlineEmphasis($Excerpt)\n    {\n        if ( ! isset($Excerpt['text'][1]))\n        {\n            return;\n        }\n\n        $marker = $Excerpt['text'][0];\n\n        if ($Excerpt['text'][1] === $marker and preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches))\n        {\n            $emphasis = 'strong';\n        }\n        elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches))\n        {\n            $emphasis = 'em';\n        }\n        else\n        {\n            return;\n        }\n\n        return array(\n            'extent' => strlen($matches[0]),\n            'element' => array(\n                'name' => $emphasis,\n                'handler' => array(\n                    'function' => 'lineElements',\n                    'argument' => $matches[1],\n                    'destination' => 'elements',\n                )\n            ),\n        );\n    }\n\n    protected function inlineEscapeSequence($Excerpt)\n    {\n        if (isset($Excerpt['text'][1]) and in_array($Excerpt['text'][1], $this->specialCharacters))\n        {\n            return array(\n                'element' => array('rawHtml' => $Excerpt['text'][1]),\n                'extent' => 2,\n            );\n        }\n    }\n\n    protected function inlineImage($Excerpt)\n    {\n        if ( ! isset($Excerpt['text'][1]) or $Excerpt['text'][1] !== '[')\n        {\n            return;\n        }\n\n        $Excerpt['text']= substr($Excerpt['text'], 1);\n\n        $Link = $this->inlineLink($Excerpt);\n\n        if ($Link === null)\n        {\n            return;\n        }\n\n        $Inline = array(\n            'extent' => $Link['extent'] + 1,\n            'element' => array(\n                'name' => 'img',\n                'attributes' => array(\n                    'src' => $Link['element']['attributes']['href'],\n                    'alt' => $Link['element']['handler']['argument'],\n                ),\n                'autobreak' => true,\n            ),\n        );\n\n        $Inline['element']['attributes'] += $Link['element']['attributes'];\n\n        unset($Inline['element']['attributes']['href']);\n\n        return $Inline;\n    }\n\n    protected function inlineLink($Excerpt)\n    {\n        $Element = array(\n            'name' => 'a',\n            'handler' => array(\n                'function' => 'lineElements',\n                'argument' => null,\n                'destination' => 'elements',\n            ),\n            'nonNestables' => array('Url', 'Link'),\n            'attributes' => array(\n                'href' => null,\n                'title' => null,\n            ),\n        );\n\n        $extent = 0;\n\n        $remainder = $Excerpt['text'];\n\n        if (preg_match('/\\[((?:[^][]++|(?R))*+)\\]/', $remainder, $matches))\n        {\n            $Element['handler']['argument'] = $matches[1];\n\n            $extent += strlen($matches[0]);\n\n            $remainder = substr($remainder, $extent);\n        }\n        else\n        {\n            return;\n        }\n\n        if (preg_match('/^[(]\\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+(\"[^\"]*+\"|\\'[^\\']*+\\'))?\\s*+[)]/', $remainder, $matches))\n        {\n            $Element['attributes']['href'] = $matches[1];\n\n            if (isset($matches[2]))\n            {\n                $Element['attributes']['title'] = substr($matches[2], 1, - 1);\n            }\n\n            $extent += strlen($matches[0]);\n        }\n        else\n        {\n            if (preg_match('/^\\s*\\[(.*?)\\]/', $remainder, $matches))\n            {\n                $definition = strlen($matches[1]) ? $matches[1] : $Element['handler']['argument'];\n                $definition = strtolower($definition);\n\n                $extent += strlen($matches[0]);\n            }\n            else\n            {\n                $definition = strtolower($Element['handler']['argument']);\n            }\n\n            if ( ! isset($this->DefinitionData['Reference'][$definition]))\n            {\n                return;\n            }\n\n            $Definition = $this->DefinitionData['Reference'][$definition];\n\n            $Element['attributes']['href'] = $Definition['url'];\n            $Element['attributes']['title'] = $Definition['title'];\n        }\n\n        return array(\n            'extent' => $extent,\n            'element' => $Element,\n        );\n    }\n\n    protected function inlineMarkup($Excerpt)\n    {\n        if ($this->markupEscaped or $this->safeMode or strpos($Excerpt['text'], '>') === false)\n        {\n            return;\n        }\n\n        if ($Excerpt['text'][1] === '/' and preg_match('/^<\\/\\w[\\w-]*+[ ]*+>/s', $Excerpt['text'], $matches))\n        {\n            return array(\n                'element' => array('rawHtml' => $matches[0]),\n                'extent' => strlen($matches[0]),\n            );\n        }\n\n        if ($Excerpt['text'][1] === '!' and preg_match('/^<!---?[^>-](?:-?+[^-])*-->/s', $Excerpt['text'], $matches))\n        {\n            return array(\n                'element' => array('rawHtml' => $matches[0]),\n                'extent' => strlen($matches[0]),\n            );\n        }\n\n        if ($Excerpt['text'][1] !== ' ' and preg_match('/^<\\w[\\w-]*+(?:[ ]*+'.$this->regexHtmlAttribute.')*+[ ]*+\\/?>/s', $Excerpt['text'], $matches))\n        {\n            return array(\n                'element' => array('rawHtml' => $matches[0]),\n                'extent' => strlen($matches[0]),\n            );\n        }\n    }\n\n    protected function inlineSpecialCharacter($Excerpt)\n    {\n        if (substr($Excerpt['text'], 1, 1) !== ' ' and strpos($Excerpt['text'], ';') !== false\n            and preg_match('/^&(#?+[0-9a-zA-Z]++);/', $Excerpt['text'], $matches)\n        ) {\n            return array(\n                'element' => array('rawHtml' => '&' . $matches[1] . ';'),\n                'extent' => strlen($matches[0]),\n            );\n        }\n    }\n\n    protected function inlineStrikethrough($Excerpt)\n    {\n        if ( ! isset($Excerpt['text'][1]))\n        {\n            return;\n        }\n\n        if ($Excerpt['text'][1] === '~' and preg_match('/^~~(?=\\S)(.+?)(?<=\\S)~~/', $Excerpt['text'], $matches))\n        {\n            return array(\n                'extent' => strlen($matches[0]),\n                'element' => array(\n                    'name' => 'del',\n                    'handler' => array(\n                        'function' => 'lineElements',\n                        'argument' => $matches[1],\n                        'destination' => 'elements',\n                    )\n                ),\n            );\n        }\n    }\n\n    protected function inlineUrl($Excerpt)\n    {\n        if ($this->urlsLinked !== true or ! isset($Excerpt['text'][2]) or $Excerpt['text'][2] !== '/')\n        {\n            return;\n        }\n\n        if (strpos($Excerpt['context'], 'http') !== false\n            and preg_match('/\\bhttps?+:[\\/]{2}[^\\s<]+\\b\\/*+/ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE)\n        ) {\n            $url = $matches[0][0];\n\n            $Inline = array(\n                'extent' => strlen($matches[0][0]),\n                'position' => $matches[0][1],\n                'element' => array(\n                    'name' => 'a',\n                    'text' => $url,\n                    'attributes' => array(\n                        'href' => $url,\n                    ),\n                ),\n            );\n\n            return $Inline;\n        }\n    }\n\n    protected function inlineUrlTag($Excerpt)\n    {\n        if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<(\\w++:\\/{2}[^ >]++)>/i', $Excerpt['text'], $matches))\n        {\n            $url = $matches[1];\n\n            return array(\n                'extent' => strlen($matches[0]),\n                'element' => array(\n                    'name' => 'a',\n                    'text' => $url,\n                    'attributes' => array(\n                        'href' => $url,\n                    ),\n                ),\n            );\n        }\n    }\n\n    # ~\n\n    protected function unmarkedText($text)\n    {\n        $Inline = $this->inlineText($text);\n        return $this->element($Inline['element']);\n    }\n\n    #\n    # Handlers\n    #\n\n    protected function handle(array $Element)\n    {\n        if (isset($Element['handler']))\n        {\n            if (!isset($Element['nonNestables']))\n            {\n                $Element['nonNestables'] = array();\n            }\n\n            if (is_string($Element['handler']))\n            {\n                $function = $Element['handler'];\n                $argument = $Element['text'];\n                unset($Element['text']);\n                $destination = 'rawHtml';\n            }\n            else\n            {\n                $function = $Element['handler']['function'];\n                $argument = $Element['handler']['argument'];\n                $destination = $Element['handler']['destination'];\n            }\n\n            $Element[$destination] = $this->{$function}($argument, $Element['nonNestables']);\n\n            if ($destination === 'handler')\n            {\n                $Element = $this->handle($Element);\n            }\n\n            unset($Element['handler']);\n        }\n\n        return $Element;\n    }\n\n    protected function handleElementRecursive(array $Element)\n    {\n        return $this->elementApplyRecursive(array($this, 'handle'), $Element);\n    }\n\n    protected function handleElementsRecursive(array $Elements)\n    {\n        return $this->elementsApplyRecursive(array($this, 'handle'), $Elements);\n    }\n\n    protected function elementApplyRecursive($closure, array $Element)\n    {\n        $Element = call_user_func($closure, $Element);\n\n        if (isset($Element['elements']))\n        {\n            $Element['elements'] = $this->elementsApplyRecursive($closure, $Element['elements']);\n        }\n        elseif (isset($Element['element']))\n        {\n            $Element['element'] = $this->elementApplyRecursive($closure, $Element['element']);\n        }\n\n        return $Element;\n    }\n\n    protected function elementApplyRecursiveDepthFirst($closure, array $Element)\n    {\n        if (isset($Element['elements']))\n        {\n            $Element['elements'] = $this->elementsApplyRecursiveDepthFirst($closure, $Element['elements']);\n        }\n        elseif (isset($Element['element']))\n        {\n            $Element['element'] = $this->elementsApplyRecursiveDepthFirst($closure, $Element['element']);\n        }\n\n        $Element = call_user_func($closure, $Element);\n\n        return $Element;\n    }\n\n    protected function elementsApplyRecursive($closure, array $Elements)\n    {\n        foreach ($Elements as &$Element)\n        {\n            $Element = $this->elementApplyRecursive($closure, $Element);\n        }\n\n        return $Elements;\n    }\n\n    protected function elementsApplyRecursiveDepthFirst($closure, array $Elements)\n    {\n        foreach ($Elements as &$Element)\n        {\n            $Element = $this->elementApplyRecursiveDepthFirst($closure, $Element);\n        }\n\n        return $Elements;\n    }\n\n    protected function element(array $Element)\n    {\n        if ($this->safeMode)\n        {\n            $Element = $this->sanitiseElement($Element);\n        }\n\n        # identity map if element has no handler\n        $Element = $this->handle($Element);\n\n        $hasName = isset($Element['name']);\n\n        $markup = '';\n\n        if ($hasName)\n        {\n            $markup .= '<' . $Element['name'];\n\n            if (isset($Element['attributes']))\n            {\n                foreach ($Element['attributes'] as $name => $value)\n                {\n                    if ($value === null)\n                    {\n                        continue;\n                    }\n\n                    $markup .= \" $name=\\\"\".self::escape($value).'\"';\n                }\n            }\n        }\n\n        $permitRawHtml = false;\n\n        if (isset($Element['text']))\n        {\n            $text = $Element['text'];\n        }\n        // very strongly consider an alternative if you're writing an\n        // extension\n        elseif (isset($Element['rawHtml']))\n        {\n            $text = $Element['rawHtml'];\n\n            $allowRawHtmlInSafeMode = isset($Element['allowRawHtmlInSafeMode']) && $Element['allowRawHtmlInSafeMode'];\n            $permitRawHtml = !$this->safeMode || $allowRawHtmlInSafeMode;\n        }\n\n        $hasContent = isset($text) || isset($Element['element']) || isset($Element['elements']);\n\n        if ($hasContent)\n        {\n            $markup .= $hasName ? '>' : '';\n\n            if (isset($Element['elements']))\n            {\n                $markup .= $this->elements($Element['elements']);\n            }\n            elseif (isset($Element['element']))\n            {\n                $markup .= $this->element($Element['element']);\n            }\n            else\n            {\n                if (!$permitRawHtml)\n                {\n                    $markup .= self::escape($text, true);\n                }\n                else\n                {\n                    $markup .= $text;\n                }\n            }\n\n            $markup .= $hasName ? '</' . $Element['name'] . '>' : '';\n        }\n        elseif ($hasName)\n        {\n            $markup .= ' />';\n        }\n\n        return $markup;\n    }\n\n    protected function elements(array $Elements)\n    {\n        $markup = '';\n\n        $autoBreak = true;\n\n        foreach ($Elements as $Element)\n        {\n            if (empty($Element))\n            {\n                continue;\n            }\n\n            $autoBreakNext = (isset($Element['autobreak'])\n                ? $Element['autobreak'] : isset($Element['name'])\n            );\n            // (autobreak === false) covers both sides of an element\n            $autoBreak = !$autoBreak ? $autoBreak : $autoBreakNext;\n\n            $markup .= ($autoBreak ? \"\\n\" : '') . $this->element($Element);\n            $autoBreak = $autoBreakNext;\n        }\n\n        $markup .= $autoBreak ? \"\\n\" : '';\n\n        return $markup;\n    }\n\n    # ~\n\n    protected function li($lines)\n    {\n        $Elements = $this->linesElements($lines);\n\n        if ( ! in_array('', $lines)\n            and isset($Elements[0]) and isset($Elements[0]['name'])\n            and $Elements[0]['name'] === 'p'\n        ) {\n            unset($Elements[0]['name']);\n        }\n\n        return $Elements;\n    }\n\n    #\n    # AST Convenience\n    #\n\n    /**\n     * Replace occurrences $regexp with $Elements in $text. Return an array of\n     * elements representing the replacement.\n     */\n    protected static function pregReplaceElements($regexp, $Elements, $text)\n    {\n        $newElements = array();\n\n        while (preg_match($regexp, $text, $matches, PREG_OFFSET_CAPTURE))\n        {\n            $offset = $matches[0][1];\n            $before = substr($text, 0, $offset);\n            $after = substr($text, $offset + strlen($matches[0][0]));\n\n            $newElements[] = array('text' => $before);\n\n            foreach ($Elements as $Element)\n            {\n                $newElements[] = $Element;\n            }\n\n            $text = $after;\n        }\n\n        $newElements[] = array('text' => $text);\n\n        return $newElements;\n    }\n\n    #\n    # Deprecated Methods\n    #\n\n    /**\n     * @deprecated use text() instead\n     */\n    function parse($text)\n    {\n        $markup = $this->text($text);\n\n        return $markup;\n    }\n\n    protected function sanitiseElement(array $Element)\n    {\n        static $goodAttribute = '/^[a-zA-Z0-9][a-zA-Z0-9-_]*+$/';\n        static $safeUrlNameToAtt  = array(\n            'a'   => 'href',\n            'img' => 'src',\n        );\n\n        if ( ! isset($Element['name']))\n        {\n            unset($Element['attributes']);\n            return $Element;\n        }\n\n        if (isset($safeUrlNameToAtt[$Element['name']]))\n        {\n            $Element = $this->filterUnsafeUrlInAttribute($Element, $safeUrlNameToAtt[$Element['name']]);\n        }\n\n        if ( ! empty($Element['attributes']))\n        {\n            foreach ($Element['attributes'] as $att => $val)\n            {\n                # filter out badly parsed attribute\n                if ( ! preg_match($goodAttribute, $att))\n                {\n                    unset($Element['attributes'][$att]);\n                }\n                # dump onevent attribute\n                elseif (self::striAtStart($att, 'on'))\n                {\n                    unset($Element['attributes'][$att]);\n                }\n            }\n        }\n\n        return $Element;\n    }\n\n    protected function filterUnsafeUrlInAttribute(array $Element, $attribute)\n    {\n        foreach ($this->safeLinksWhitelist as $scheme)\n        {\n            if (self::striAtStart($Element['attributes'][$attribute], $scheme))\n            {\n                return $Element;\n            }\n        }\n\n        $Element['attributes'][$attribute] = str_replace(':', '%3A', $Element['attributes'][$attribute]);\n\n        return $Element;\n    }\n\n    #\n    # Static Methods\n    #\n\n    protected static function escape($text, $allowQuotes = false)\n    {\n        return htmlspecialchars($text, $allowQuotes ? ENT_NOQUOTES : ENT_QUOTES, 'UTF-8');\n    }\n\n    protected static function striAtStart($string, $needle)\n    {\n        $len = strlen($needle);\n\n        if ($len > strlen($string))\n        {\n            return false;\n        }\n        else\n        {\n            return strtolower(substr($string, 0, $len)) === strtolower($needle);\n        }\n    }\n\n    static function instance($name = 'default')\n    {\n        if (isset(self::$instances[$name]))\n        {\n            return self::$instances[$name];\n        }\n\n        $instance = new static();\n\n        self::$instances[$name] = $instance;\n\n        return $instance;\n    }\n\n    private static $instances = array();\n\n    #\n    # Fields\n    #\n\n    protected $DefinitionData;\n\n    #\n    # Read-Only\n\n    protected $specialCharacters = array(\n        '\\\\', '`', '*', '_', '{', '}', '[', ']', '(', ')', '>', '#', '+', '-', '.', '!', '|', '~'\n    );\n\n    protected $StrongRegex = array(\n        '*' => '/^[*]{2}((?:\\\\\\\\\\*|[^*]|[*][^*]*+[*])+?)[*]{2}(?![*])/s',\n        '_' => '/^__((?:\\\\\\\\_|[^_]|_[^_]*+_)+?)__(?!_)/us',\n    );\n\n    protected $EmRegex = array(\n        '*' => '/^[*]((?:\\\\\\\\\\*|[^*]|[*][*][^*]+?[*][*])+?)[*](?![*])/s',\n        '_' => '/^_((?:\\\\\\\\_|[^_]|__[^_]*__)+?)_(?!_)\\b/us',\n    );\n\n    protected $regexHtmlAttribute = '[a-zA-Z_:][\\w:.-]*+(?:\\s*+=\\s*+(?:[^\"\\'=<>`\\s]+|\"[^\"]*+\"|\\'[^\\']*+\\'))?+';\n\n    protected $voidElements = array(\n        'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source',\n    );\n\n    protected $textLevelElements = array(\n        'a', 'br', 'bdo', 'abbr', 'blink', 'nextid', 'acronym', 'basefont',\n        'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing',\n        'i', 'rp', 'del', 'code',          'strike', 'marquee',\n        'q', 'rt', 'ins', 'font',          'strong',\n        's', 'tt', 'kbd', 'mark',\n        'u', 'xm', 'sub', 'nobr',\n                   'sup', 'ruby',\n                   'var', 'span',\n                   'wbr', 'time',\n    );\n}\n"
  },
  {
    "path": "composer.json",
    "content": "{\n    \"name\": \"erusev/parsedown\",\n    \"description\": \"Parser for Markdown.\",\n    \"keywords\": [\"markdown\", \"parser\"],\n    \"homepage\": \"http://parsedown.org\",\n    \"type\": \"library\",\n    \"license\": \"MIT\",\n    \"authors\": [\n        {\n            \"name\": \"Emanuil Rusev\",\n            \"email\": \"hello@erusev.com\",\n            \"homepage\": \"http://erusev.com\"\n        }\n    ],\n    \"require\": {\n        \"php\": \">=7.2\",\n        \"ext-mbstring\": \"*\"\n    },\n    \"require-dev\": {\n        \"phpunit/phpunit\": \"^8.5.52|^9.6.33\"\n    },\n    \"autoload\": {\n        \"psr-0\": { \"Parsedown\": \"\" }\n    },\n    \"autoload-dev\": {\n        \"psr-0\": {\n            \"TestParsedown\": \"test/\",\n            \"ParsedownTest\": \"test/\",\n            \"CommonMarkTest\": \"test/\",\n            \"CommonMarkTestWeak\": \"test/\"\n        }\n    }\n}\n"
  },
  {
    "path": "phpunit.xml.dist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit bootstrap=\"vendor/autoload.php\" colors=\"true\">\n\t<testsuites>\n\t\t<testsuite name=\"Parsedown\">\n\t\t\t<file>test/ParsedownTest.php</file>\n\t\t</testsuite>\n\t</testsuites>\n</phpunit>\n"
  },
  {
    "path": "readme.md",
    "content": "# Parsedown\n\n[![Total Downloads](https://poser.pugx.org/erusev/parsedown/d/total.svg)](https://packagist.org/packages/erusev/parsedown)\n[![Version](https://poser.pugx.org/erusev/parsedown/v/stable.svg)](https://packagist.org/packages/erusev/parsedown)\n[![License](https://poser.pugx.org/erusev/parsedown/license.svg)](https://packagist.org/packages/erusev/parsedown)\n\nBetter Markdown Parser in PHP — <a href=\"https://parsedown.org/demo\">demo</a>\n\n## Features\n\n- One file\n- No dependencies\n- [Super fast](http://parsedown.org/speed)\n- Extensible\n- [GitHub flavored](https://github.github.com/gfm)\n- [Tested](http://parsedown.org/tests/) in PHP 7.1+\n- [Markdown Extra extension](https://github.com/erusev/parsedown-extra)\n\n## Installation\n\nInstall the [composer package]:\n\n```sh\ncomposer require erusev/parsedown\n```\n\nOr download the [latest release] and include `Parsedown.php`\n\n[composer package]: https://packagist.org/packages/erusev/parsedown \"The Parsedown package on packagist.org\"\n[latest release]: https://github.com/erusev/parsedown/releases/latest \"The latest release of Parsedown\"\n\n## Example\n\n```php\n$Parsedown = new Parsedown();\n\necho $Parsedown->text('Hello _Parsedown_!'); # prints: <p>Hello <em>Parsedown</em>!</p>\n```\n\nYou can also parse inline markdown only:\n\n```php\necho $Parsedown->line('Hello _Parsedown_!'); # prints: Hello <em>Parsedown</em>!\n```\n\nMore examples in [the wiki](https://github.com/erusev/parsedown/wiki/) and in [this video tutorial](http://youtu.be/wYZBY8DEikI).\n\n## Security\n\nParsedown is capable of escaping user-input within the HTML that it generates. Additionally Parsedown will apply sanitisation to additional scripting vectors (such as scripting link destinations) that are introduced by the markdown syntax itself.\n\nTo tell Parsedown that it is processing untrusted user-input, use the following:\n\n```php\n$Parsedown->setSafeMode(true);\n```\n\nIf instead, you wish to allow HTML within untrusted user-input, but still want output to be free from XSS it is recommended that you make use of a HTML sanitiser that allows HTML tags to be whitelisted, like [HTML Purifier](http://htmlpurifier.org/).\n\nIn both cases you should strongly consider employing defence-in-depth measures, like [deploying a Content-Security-Policy](https://scotthelme.co.uk/content-security-policy-an-introduction/) (a browser security feature) so that your page is likely to be safe even if an attacker finds a vulnerability in one of the first lines of defence above.\n\nSafe mode does not necessarily yield safe results when using extensions to Parsedown. Extensions should be evaluated on their own to determine their specific safety against XSS.\n\n## Escaping HTML\n\n> WARNING: This method is not safe from XSS!\n\nIf you wish to escape HTML in trusted input, you can use the following:\n\n```php\n$Parsedown->setMarkupEscaped(true);\n```\n\nBeware that this still allows users to insert unsafe scripting vectors, ex: `[xss](javascript:alert%281%29)`.\n\n## Questions\n\n**How does Parsedown work?**\n\nIt tries to read Markdown like a human. First, it looks at the lines. It’s interested in how the lines start. This helps it recognise blocks. It knows, for example, that if a line starts with a `-` then perhaps it belongs to a list. Once it recognises the blocks, it continues to the content. As it reads, it watches out for special characters. This helps it recognise inline elements (or inlines).\n\nWe call this approach \"line based\". We believe that Parsedown is the first Markdown parser to use it. Since the release of Parsedown, other developers have used the same approach to develop other Markdown parsers in PHP and in other languages.\n\n**Is it compliant with CommonMark?**\n\nIt passes most of the CommonMark tests. Most of the tests that don't pass deal with cases that are quite uncommon. Still, as CommonMark matures, compliance should improve.\n\n**Who uses it?**\n\n[Laravel Framework](https://laravel.com/), [Bolt CMS](http://bolt.cm/), [Grav CMS](http://getgrav.org/), [Herbie CMS](http://www.getherbie.org/), [Kirby CMS](http://getkirby.com/), [October CMS](http://octobercms.com/), [Pico CMS](http://picocms.org), [Statamic CMS](http://www.statamic.com/), [phpDocumentor](http://www.phpdoc.org/), [RaspberryPi.org](http://www.raspberrypi.org/), [Symfony Demo](https://github.com/symfony/demo) and [more](https://packagist.org/packages/erusev/parsedown/dependents).\n\n**How can I help?**\n\nUse it, star it, share it and if you feel generous, [sponsor me](https://github.com/sponsors/erusev).\n\n**What else should I know?**\n\nI also make [Nota](https://nota.md/) — a notes app designed for local Markdown files.\n"
  },
  {
    "path": "test/CommonMarkTestStrict.php",
    "content": "<?php\n\nuse PHPUnit\\Framework\\TestCase;\n\n/**\n * Test Parsedown against the CommonMark spec\n *\n * @link http://commonmark.org/ CommonMark\n */\nclass CommonMarkTestStrict extends TestCase\n{\n    const SPEC_URL = 'https://raw.githubusercontent.com/jgm/CommonMark/master/spec.txt';\n\n    protected $parsedown;\n\n    protected function setUp() : void\n    {\n        $this->parsedown = new TestParsedown();\n        $this->parsedown->setUrlsLinked(false);\n    }\n\n    /**\n     * @dataProvider data\n     * @param $id\n     * @param $section\n     * @param $markdown\n     * @param $expectedHtml\n     */\n    public function testExample($id, $section, $markdown, $expectedHtml)\n    {\n        $actualHtml = $this->parsedown->text($markdown);\n        $this->assertEquals($expectedHtml, $actualHtml);\n    }\n\n    /**\n     * @return array\n     */\n    public function data()\n    {\n        $spec = file_get_contents(self::SPEC_URL);\n        if ($spec === false) {\n            $this->fail('Unable to load CommonMark spec from ' . self::SPEC_URL);\n        }\n\n        $spec = str_replace(\"\\r\\n\", \"\\n\", $spec);\n        $spec = strstr($spec, '<!-- END TESTS -->', true);\n\n        $matches = array();\n        preg_match_all('/^`{32} example\\n((?s).*?)\\n\\.\\n(?:|((?s).*?)\\n)`{32}$|^#{1,6} *(.*?)$/m', $spec, $matches, PREG_SET_ORDER);\n\n        $data = array();\n        $currentId = 0;\n        $currentSection = '';\n        foreach ($matches as $match) {\n            if (isset($match[3])) {\n                $currentSection = $match[3];\n            } else {\n                $currentId++;\n                $markdown = str_replace('→', \"\\t\", $match[1]);\n                $expectedHtml = isset($match[2]) ? str_replace('→', \"\\t\", $match[2]) : '';\n\n                $data[$currentId] = array(\n                    'id' => $currentId,\n                    'section' => $currentSection,\n                    'markdown' => $markdown,\n                    'expectedHtml' => $expectedHtml\n                );\n            }\n        }\n\n        return $data;\n    }\n}\n"
  },
  {
    "path": "test/CommonMarkTestWeak.php",
    "content": "<?php\nrequire_once(__DIR__ . '/CommonMarkTestStrict.php');\n\n/**\n * Test Parsedown against the CommonMark spec, but less aggressive\n *\n * The resulting HTML markup is cleaned up before comparison, so examples\n * which would normally fail due to actually invisible differences (e.g.\n * superfluous whitespaces), don't fail. However, cleanup relies on block\n * element detection. The detection doesn't work correctly when a element's\n * `display` CSS property is manipulated. According to that this test is only\n * a interim solution on Parsedown's way to full CommonMark compatibility.\n *\n * @link http://commonmark.org/ CommonMark\n */\nclass CommonMarkTestWeak extends CommonMarkTestStrict\n{\n    protected $textLevelElementRegex;\n\n    protected function setUp() : void\n    {\n        parent::setUp();\n\n        $textLevelElements = $this->parsedown->getTextLevelElements();\n        array_walk($textLevelElements, function (&$element) {\n            $element = preg_quote($element, '/');\n        });\n        $this->textLevelElementRegex = '\\b(?:' . implode('|', $textLevelElements) . ')\\b';\n    }\n\n    /**\n     * @dataProvider data\n     * @param $id\n     * @param $section\n     * @param $markdown\n     * @param $expectedHtml\n     */\n    public function testExample($id, $section, $markdown, $expectedHtml)\n    {\n        $expectedHtml = $this->cleanupHtml($expectedHtml);\n\n        $actualHtml = $this->parsedown->text($markdown);\n        $actualHtml = $this->cleanupHtml($actualHtml);\n\n        $this->assertEquals($expectedHtml, $actualHtml);\n    }\n\n    protected function cleanupHtml($markup)\n    {\n        // invisible whitespaces at the beginning and end of block elements\n        // however, whitespaces at the beginning of <pre> elements do matter\n        $markup = preg_replace(\n            array(\n                '/(<(?!(?:' . $this->textLevelElementRegex . '|\\bpre\\b))\\w+\\b[^>]*>(?:<' . $this->textLevelElementRegex . '[^>]*>)*)\\s+/s',\n                '/\\s+((?:<\\/' . $this->textLevelElementRegex . '>)*<\\/(?!' . $this->textLevelElementRegex . ')\\w+\\b>)/s'\n            ),\n            '$1',\n            $markup\n        );\n\n        return $markup;\n    }\n}\n"
  },
  {
    "path": "test/ParsedownTest.php",
    "content": "<?php\nrequire 'SampleExtensions.php';\n\nuse PHPUnit\\Framework\\TestCase;\n\nclass ParsedownTest extends TestCase\n{\n    final function __construct($name = null, array $data = array(), $dataName = '')\n    {\n        $this->dirs = $this->initDirs();\n        $this->Parsedown = $this->initParsedown();\n\n        parent::__construct($name, $data, $dataName);\n    }\n\n    private $dirs;\n    protected $Parsedown;\n\n    /**\n     * @return array\n     */\n    protected function initDirs()\n    {\n        $dirs []= dirname(__FILE__).'/data/';\n\n        return $dirs;\n    }\n\n    /**\n     * @return Parsedown\n     */\n    protected function initParsedown()\n    {\n        $Parsedown = new TestParsedown();\n\n        return $Parsedown;\n    }\n\n    /**\n     * @dataProvider data\n     * @param $test\n     * @param $dir\n     */\n    function test_($test, $dir)\n    {\n        $markdown = file_get_contents($dir . $test . '.md');\n\n        $expectedMarkup = file_get_contents($dir . $test . '.html');\n\n        $expectedMarkup = str_replace(\"\\r\\n\", \"\\n\", $expectedMarkup);\n        $expectedMarkup = str_replace(\"\\r\", \"\\n\", $expectedMarkup);\n\n        $this->Parsedown->setSafeMode(substr($test, 0, 3) === 'xss');\n        $this->Parsedown->setStrictMode(substr($test, 0, 6) === 'strict');\n\n        $actualMarkup = $this->Parsedown->text($markdown);\n\n        $this->assertEquals($expectedMarkup, $actualMarkup);\n    }\n\n    function testRawHtml()\n    {\n        $markdown = \"```php\\nfoobar\\n```\";\n        $expectedMarkup = '<pre><code class=\"language-php\"><p>foobar</p></code></pre>';\n        $expectedSafeMarkup = '<pre><code class=\"language-php\">&lt;p&gt;foobar&lt;/p&gt;</code></pre>';\n\n        $unsafeExtension = new UnsafeExtension;\n        $actualMarkup = $unsafeExtension->text($markdown);\n\n        $this->assertEquals($expectedMarkup, $actualMarkup);\n\n        $unsafeExtension->setSafeMode(true);\n        $actualSafeMarkup = $unsafeExtension->text($markdown);\n\n        $this->assertEquals($expectedSafeMarkup, $actualSafeMarkup);\n    }\n\n    function testTrustDelegatedRawHtml()\n    {\n        $markdown = \"```php\\nfoobar\\n```\";\n        $expectedMarkup = '<pre><code class=\"language-php\"><p>foobar</p></code></pre>';\n        $expectedSafeMarkup = $expectedMarkup;\n\n        $unsafeExtension = new TrustDelegatedExtension;\n        $actualMarkup = $unsafeExtension->text($markdown);\n\n        $this->assertEquals($expectedMarkup, $actualMarkup);\n\n        $unsafeExtension->setSafeMode(true);\n        $actualSafeMarkup = $unsafeExtension->text($markdown);\n\n        $this->assertEquals($expectedSafeMarkup, $actualSafeMarkup);\n    }\n\n    function data()\n    {\n        $data = array();\n\n        foreach ($this->dirs as $dir)\n        {\n            $Folder = new DirectoryIterator($dir);\n\n            foreach ($Folder as $File)\n            {\n                /** @var $File DirectoryIterator */\n\n                if ( ! $File->isFile())\n                {\n                    continue;\n                }\n\n                $filename = $File->getFilename();\n\n                $extension = pathinfo($filename, PATHINFO_EXTENSION);\n\n                if ($extension !== 'md')\n                {\n                    continue;\n                }\n\n                $basename = $File->getBasename('.md');\n\n                if (file_exists($dir . $basename . '.html'))\n                {\n                    $data []= array($basename, $dir);\n                }\n            }\n        }\n\n        return $data;\n    }\n\n    public function test_no_markup()\n    {\n        $markdownWithHtml = <<<MARKDOWN_WITH_MARKUP\n<div>_content_</div>\n\nsparse:\n\n<div>\n<div class=\"inner\">\n_content_\n</div>\n</div>\n\nparagraph\n\n<style type=\"text/css\">\n    p {\n        color: red;\n    }\n</style>\n\ncomment\n\n<!-- html comment -->\nMARKDOWN_WITH_MARKUP;\n\n        $expectedHtml = <<<EXPECTED_HTML\n<p>&lt;div&gt;<em>content</em>&lt;/div&gt;</p>\n<p>sparse:</p>\n<p>&lt;div&gt;\n&lt;div class=\"inner\"&gt;\n<em>content</em>\n&lt;/div&gt;\n&lt;/div&gt;</p>\n<p>paragraph</p>\n<p>&lt;style type=\"text/css\"&gt;\np {\ncolor: red;\n}\n&lt;/style&gt;</p>\n<p>comment</p>\n<p>&lt;!-- html comment --&gt;</p>\nEXPECTED_HTML;\n\n        $parsedownWithNoMarkup = new TestParsedown();\n        $parsedownWithNoMarkup->setMarkupEscaped(true);\n        $this->assertEquals($expectedHtml, $parsedownWithNoMarkup->text($markdownWithHtml));\n    }\n\n    public function testLateStaticBinding()\n    {\n        $parsedown = Parsedown::instance();\n        $this->assertInstanceOf('Parsedown', $parsedown);\n\n        // After instance is already called on Parsedown\n        // subsequent calls with the same arguments return the same instance\n        $sameParsedown = TestParsedown::instance();\n        $this->assertInstanceOf('Parsedown', $sameParsedown);\n        $this->assertSame($parsedown, $sameParsedown);\n\n        $testParsedown = TestParsedown::instance('test late static binding');\n        $this->assertInstanceOf('TestParsedown', $testParsedown);\n\n        $sameInstanceAgain = TestParsedown::instance('test late static binding');\n        $this->assertSame($testParsedown, $sameInstanceAgain);\n    }\n}\n"
  },
  {
    "path": "test/SampleExtensions.php",
    "content": "<?php\n\nclass UnsafeExtension extends Parsedown\n{\n    protected function blockFencedCodeComplete($Block)\n    {\n        $text = $Block['element']['element']['text'];\n        unset($Block['element']['element']['text']);\n\n        // WARNING: There is almost always a better way of doing things!\n        //\n        // This example is one of them, unsafe behaviour is NOT needed here.\n        // Only use this if you trust the input and have no idea what\n        // the output HTML will look like (e.g. using an external parser).\n        $Block['element']['element']['rawHtml'] = \"<p>$text</p>\";\n\n        return $Block;\n    }\n}\n\n\nclass TrustDelegatedExtension extends Parsedown\n{\n    protected function blockFencedCodeComplete($Block)\n    {\n        $text = $Block['element']['element']['text'];\n        unset($Block['element']['element']['text']);\n\n        // WARNING: There is almost always a better way of doing things!\n        //\n        // This behaviour is NOT needed in the demonstrated case.\n        // Only use this if you are sure that the result being added into\n        // rawHtml is safe.\n        // (e.g. using an external parser with escaping capabilities).\n        $Block['element']['element']['rawHtml'] = \"<p>$text</p>\";\n        $Block['element']['element']['allowRawHtmlInSafeMode'] = true;\n\n        return $Block;\n    }\n}\n"
  },
  {
    "path": "test/TestParsedown.php",
    "content": "<?php\n\nclass TestParsedown extends Parsedown\n{\n    public function getTextLevelElements()\n    {\n        return $this->textLevelElements;\n    }\n}\n"
  },
  {
    "path": "test/data/aesthetic_table.html",
    "content": "<table>\n<thead>\n<tr>\n<th>header 1</th>\n<th>header 2</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>cell 1.1</td>\n<td>cell 1.2</td>\n</tr>\n<tr>\n<td>cell 2.1</td>\n<td>cell 2.2</td>\n</tr>\n</tbody>\n</table>"
  },
  {
    "path": "test/data/aligned_table.html",
    "content": "<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">header 1</th>\n<th style=\"text-align: center;\">header 2</th>\n<th style=\"text-align: right;\">header 2</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">cell 1.1</td>\n<td style=\"text-align: center;\">cell 1.2</td>\n<td style=\"text-align: right;\">cell 1.3</td>\n</tr>\n<tr>\n<td style=\"text-align: left;\">cell 2.1</td>\n<td style=\"text-align: center;\">cell 2.2</td>\n<td style=\"text-align: right;\">cell 2.3</td>\n</tr>\n</tbody>\n</table>"
  },
  {
    "path": "test/data/atx_heading.html",
    "content": "<h1>h1</h1>\n<h2>h2</h2>\n<h3>h3</h3>\n<h4>h4</h4>\n<h5>h5</h5>\n<h6>h6</h6>\n<p>####### not a heading</p>\n<h1>closed h1</h1>\n<h1></h1>\n<h2></h2>\n<h1># of levels</h1>\n<h1># of levels #</h1>\n<h1>heading</h1>"
  },
  {
    "path": "test/data/automatic_link.html",
    "content": "<p><a href=\"http://example.com\">http://example.com</a></p>"
  },
  {
    "path": "test/data/block-level_html.html",
    "content": "<div>_content_</div>\n<p>paragraph</p>\n<div>\n  <div class=\"inner\">\n    _content_\n  </div>\n</div>\n<style type=\"text/css\">\n  p {color: #789;}\n</style>\n<div>\n  <a href=\"/\">home</a></div>"
  },
  {
    "path": "test/data/code_block.html",
    "content": "<pre><code>&lt;?php\n\n$message = 'Hello World!';\necho $message;</code></pre>\n<hr />\n<pre><code>&gt; not a quote\n- not a list item\n[not a reference]: http://foo.com</code></pre>\n<hr />\n<pre><code>foo\n\n\nbar</code></pre>"
  },
  {
    "path": "test/data/code_span.html",
    "content": "<p>a <code>code span</code></p>\n<p><code>this is also a codespan</code> trailing text</p>\n<p><code>and look at this one!</code></p>\n<p>single backtick in a code span: <code>`</code></p>\n<p>backtick-delimited string in a code span: <code>`foo`</code></p>\n<p><code>sth `` sth</code></p>"
  },
  {
    "path": "test/data/compound_blockquote.html",
    "content": "<blockquote>\n<h2>header</h2>\n<p>paragraph</p>\n<ul>\n<li>li</li>\n</ul>\n<hr />\n<p>paragraph</p>\n</blockquote>"
  },
  {
    "path": "test/data/compound_emphasis.html",
    "content": "<p><em><code>code</code></em> <strong><code>code</code></strong></p>\n<p><em><code>code</code><strong><code>code</code></strong><code>code</code></em></p>"
  },
  {
    "path": "test/data/compound_list.html",
    "content": "<ul>\n<li>\n<p>paragraph</p>\n<p>paragraph</p>\n</li>\n<li>\n<p>paragraph</p>\n<blockquote>\n<p>quote</p>\n</blockquote>\n</li>\n</ul>"
  },
  {
    "path": "test/data/deeply_nested_list.html",
    "content": "<ul>\n<li>li<ul>\n<li>li<ul>\n<li>li</li>\n<li>li</li>\n</ul>\n</li>\n<li>li</li>\n</ul>\n</li>\n<li>li</li>\n</ul>\n<hr />\n<ul>\n<li>level 1<ul>\n<li>level 2<ul>\n<li>level 3<ul>\n<li>level 4<ul>\n<li>level 5</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n<hr />\n<ul>\n<li>a</li>\n<li>b</li>\n<li>c</li>\n<li>d</li>\n<li>e</li>\n<li>f</li>\n<li>g</li>\n<li>h</li>\n<li>i</li>\n</ul>"
  },
  {
    "path": "test/data/em_strong.html",
    "content": "<p><strong><em>em strong</em></strong></p>\n<p><strong><em>em strong</em> strong</strong></p>\n<p><strong>strong <em>em strong</em></strong></p>\n<p><strong>strong <em>em strong</em> strong</strong></p>\n<p><strong><em>em strong</em></strong></p>\n<p><strong><em>em strong</em> strong</strong></p>\n<p><strong>strong <em>em strong</em></strong></p>\n<p><strong>strong <em>em strong</em> strong</strong></p>"
  },
  {
    "path": "test/data/email.html",
    "content": "<p>my email is <a href=\"mailto:me@example.com\">me@example.com</a></p>\n<p>html tags shouldn't start an email autolink <strong>first.last@example.com</strong></p>"
  },
  {
    "path": "test/data/emphasis.html",
    "content": "<p><em>underscore</em>, <em>asterisk</em>, <em>one two</em>, <em>three four</em>, <em>a</em>, <em>b</em></p>\n<p><strong>strong</strong> and <em>em</em> and <strong>strong</strong> and <em>em</em></p>\n<p><em>line\nline\nline</em></p>\n<p>this_is_not_an_emphasis</p>\n<p>an empty emphasis __ ** is not an emphasis</p>\n<p>*mixed *<em>double and</em> single asterisk** spans</p>"
  },
  {
    "path": "test/data/escaping.html",
    "content": "<p>escaped *emphasis*.</p>\n<p><code>escaped \\*emphasis\\* in a code span</code></p>\n<pre><code>escaped \\*emphasis\\* in a code block</code></pre>\n<p>\\ ` * _ { } [ ] ( ) > # + - . !</p>\n<p><em>one_two</em> <strong>one_two</strong></p>\n<p><em>one*two</em> <strong>one*two</strong></p>"
  },
  {
    "path": "test/data/fenced_code_block.html",
    "content": "<pre><code>&lt;?php\n\n$message = 'fenced code block';\necho $message;</code></pre>\n<pre><code>tilde</code></pre>\n<pre><code class=\"language-php\">echo 'language identifier';</code></pre>\n<pre><code class=\"language-c#\">echo 'language identifier with non words';</code></pre>\n<pre><code class=\"language-html+php\">&lt;?php\necho \"Hello World\";\n?&gt;\n&lt;a href=\"http://auraphp.com\" &gt;Aura Project&lt;/a&gt;</code></pre>\n<pre><code>the following isn't quite enough to close\n```\nstill a fenced code block</code></pre>\n<pre><code>foo\n\n\nbar</code></pre>\n<pre><code class=\"language-php\">&lt;?php\necho \"Hello World\";</code></pre>"
  },
  {
    "path": "test/data/horizontal_rule.html",
    "content": "<hr />\n<hr />\n<hr />\n<hr />\n<hr />"
  },
  {
    "path": "test/data/html_comment.html",
    "content": "<!-- single line -->\n<p>paragraph</p>\n<!-- \n  multiline -->\n<p>paragraph</p>\n<!-- sss -->abc\n<ul>\n<li>abcd</li>\n<li>bbbb</li>\n<li>cccc</li>\n</ul>"
  },
  {
    "path": "test/data/html_entity.html",
    "content": "<p>&amp; &copy; &#123;</p>"
  },
  {
    "path": "test/data/image_reference.html",
    "content": "<p><img src=\"/md.png\" alt=\"Markdown Logo\" /></p>\n<p>![missing reference]</p>"
  },
  {
    "path": "test/data/image_title.html",
    "content": "<p><img src=\"/md.png\" alt=\"alt\" title=\"title\" /></p>\n<p><img src=\"/md.png\" alt=\"blank title\" title=\"\" /></p>"
  },
  {
    "path": "test/data/implicit_reference.html",
    "content": "<p>an <a href=\"http://example.com\">implicit</a> reference link</p>\n<p>an <a href=\"http://example.com\">implicit</a> reference link with an empty link definition</p>\n<p>an <a href=\"http://example.com\">implicit</a> reference link followed by <a href=\"http://cnn.com\">another</a></p>\n<p>an <a href=\"http://example.com\" title=\"Example\">explicit</a> reference link with a title</p>"
  },
  {
    "path": "test/data/inline_link.html",
    "content": "<p><a href=\"http://example.com\">link</a></p>\n<p><a href=\"/url-(parentheses)\">link</a> with parentheses in URL </p>\n<p>(<a href=\"/index.php\">link</a>) in parentheses</p>\n<p><a href=\"http://example.com\"><code>link</code></a></p>\n<p><a href=\"http://example.com\"><img src=\"http://parsedown.org/md.png\" alt=\"MD Logo\" /></a></p>\n<p><a href=\"http://example.com\"><img src=\"http://parsedown.org/md.png\" alt=\"MD Logo\" /> and text</a></p>\n<p><a href=\"http://example.com\"><img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAUCAYAAADskT9PAAAKQWlDQ1BJQ0MgUHJvZmlsZQAASA2dlndUU9kWh8+9N73QEiIgJfQaegkg0jtIFQRRiUmAUAKGhCZ2RAVGFBEpVmRUwAFHhyJjRRQLg4Ji1wnyEFDGwVFEReXdjGsJ7601896a/cdZ39nnt9fZZ+9917oAUPyCBMJ0WAGANKFYFO7rwVwSE8vE9wIYEAEOWAHA4WZmBEf4RALU/L09mZmoSMaz9u4ugGS72yy/UCZz1v9/kSI3QyQGAApF1TY8fiYX5QKUU7PFGTL/BMr0lSkyhjEyFqEJoqwi48SvbPan5iu7yZiXJuShGlnOGbw0noy7UN6aJeGjjAShXJgl4GejfAdlvVRJmgDl9yjT0/icTAAwFJlfzOcmoWyJMkUUGe6J8gIACJTEObxyDov5OWieAHimZ+SKBIlJYqYR15hp5ejIZvrxs1P5YjErlMNN4Yh4TM/0tAyOMBeAr2+WRQElWW2ZaJHtrRzt7VnW5mj5v9nfHn5T/T3IevtV8Sbsz55BjJ5Z32zsrC+9FgD2JFqbHbO+lVUAtG0GQOXhrE/vIADyBQC03pzzHoZsXpLE4gwnC4vs7GxzAZ9rLivoN/ufgm/Kv4Y595nL7vtWO6YXP4EjSRUzZUXlpqemS0TMzAwOl89k/fcQ/+PAOWnNycMsnJ/AF/GF6FVR6JQJhIlou4U8gViQLmQKhH/V4X8YNicHGX6daxRodV8AfYU5ULhJB8hvPQBDIwMkbj96An3rWxAxCsi+vGitka9zjzJ6/uf6Hwtcim7hTEEiU+b2DI9kciWiLBmj34RswQISkAd0oAo0gS4wAixgDRyAM3AD3iAAhIBIEAOWAy5IAmlABLJBPtgACkEx2AF2g2pwANSBetAEToI2cAZcBFfADXALDIBHQAqGwUswAd6BaQiC8BAVokGqkBakD5lC1hAbWgh5Q0FQOBQDxUOJkBCSQPnQJqgYKoOqoUNQPfQjdBq6CF2D+qAH0CA0Bv0BfYQRmALTYQ3YALaA2bA7HAhHwsvgRHgVnAcXwNvhSrgWPg63whfhG/AALIVfwpMIQMgIA9FGWAgb8URCkFgkAREha5EipAKpRZqQDqQbuY1IkXHkAwaHoWGYGBbGGeOHWYzhYlZh1mJKMNWYY5hWTBfmNmYQM4H5gqVi1bGmWCesP3YJNhGbjS3EVmCPYFuwl7ED2GHsOxwOx8AZ4hxwfrgYXDJuNa4Etw/XjLuA68MN4SbxeLwq3hTvgg/Bc/BifCG+Cn8cfx7fjx/GvyeQCVoEa4IPIZYgJGwkVBAaCOcI/YQRwjRRgahPdCKGEHnEXGIpsY7YQbxJHCZOkxRJhiQXUiQpmbSBVElqIl0mPSa9IZPJOmRHchhZQF5PriSfIF8lD5I/UJQoJhRPShxFQtlOOUq5QHlAeUOlUg2obtRYqpi6nVpPvUR9Sn0vR5Mzl/OX48mtk6uRa5Xrl3slT5TXl3eXXy6fJ18hf0r+pvy4AlHBQMFTgaOwVqFG4bTCPYVJRZqilWKIYppiiWKD4jXFUSW8koGStxJPqUDpsNIlpSEaQtOledK4tE20Otpl2jAdRzek+9OT6cX0H+i99AllJWVb5SjlHOUa5bPKUgbCMGD4M1IZpYyTjLuMj/M05rnP48/bNq9pXv+8KZX5Km4qfJUilWaVAZWPqkxVb9UU1Z2qbapP1DBqJmphatlq+9Uuq43Pp893ns+dXzT/5PyH6rC6iXq4+mr1w+o96pMamhq+GhkaVRqXNMY1GZpumsma5ZrnNMe0aFoLtQRa5VrntV4wlZnuzFRmJbOLOaGtru2nLdE+pN2rPa1jqLNYZ6NOs84TXZIuWzdBt1y3U3dCT0svWC9fr1HvoT5Rn62fpL9Hv1t/ysDQINpgi0GbwaihiqG/YZ5ho+FjI6qRq9Eqo1qjO8Y4Y7ZxivE+41smsImdSZJJjclNU9jU3lRgus+0zwxr5mgmNKs1u8eisNxZWaxG1qA5wzzIfKN5m/krCz2LWIudFt0WXyztLFMt6ywfWSlZBVhttOqw+sPaxJprXWN9x4Zq42Ozzqbd5rWtqS3fdr/tfTuaXbDdFrtOu8/2DvYi+yb7MQc9h3iHvQ732HR2KLuEfdUR6+jhuM7xjOMHJ3snsdNJp9+dWc4pzg3OowsMF/AX1C0YctFx4bgccpEuZC6MX3hwodRV25XjWuv6zE3Xjed2xG3E3dg92f24+ysPSw+RR4vHlKeT5xrPC16Il69XkVevt5L3Yu9q76c+Oj6JPo0+E752vqt9L/hh/QL9dvrd89fw5/rX+08EOASsCegKpARGBFYHPgsyCRIFdQTDwQHBu4IfL9JfJFzUFgJC/EN2hTwJNQxdFfpzGC4sNKwm7Hm4VXh+eHcELWJFREPEu0iPyNLIR4uNFksWd0bJR8VF1UdNRXtFl0VLl1gsWbPkRoxajCCmPRYfGxV7JHZyqffS3UuH4+ziCuPuLjNclrPs2nK15anLz66QX8FZcSoeGx8d3xD/iRPCqeVMrvRfuXflBNeTu4f7kufGK+eN8V34ZfyRBJeEsoTRRJfEXYljSa5JFUnjAk9BteB1sl/ygeSplJCUoykzqdGpzWmEtPi000IlYYqwK10zPSe9L8M0ozBDuspp1e5VE6JA0ZFMKHNZZruYjv5M9UiMJJslg1kLs2qy3mdHZZ/KUcwR5vTkmuRuyx3J88n7fjVmNXd1Z752/ob8wTXuaw6thdauXNu5Tnddwbrh9b7rj20gbUjZ8MtGy41lG99uit7UUaBRsL5gaLPv5sZCuUJR4b0tzlsObMVsFWzt3WazrWrblyJe0fViy+KK4k8l3JLr31l9V/ndzPaE7b2l9qX7d+B2CHfc3em681iZYlle2dCu4F2t5czyovK3u1fsvlZhW3FgD2mPZI+0MqiyvUqvakfVp+qk6oEaj5rmvep7t+2d2sfb17/fbX/TAY0DxQc+HhQcvH/I91BrrUFtxWHc4azDz+ui6rq/Z39ff0TtSPGRz0eFR6XHwo911TvU1zeoN5Q2wo2SxrHjccdv/eD1Q3sTq+lQM6O5+AQ4ITnx4sf4H++eDDzZeYp9qukn/Z/2ttBailqh1tzWibakNml7THvf6YDTnR3OHS0/m/989Iz2mZqzymdLz5HOFZybOZ93fvJCxoXxi4kXhzpXdD66tOTSna6wrt7LgZevXvG5cqnbvfv8VZerZ645XTt9nX297Yb9jdYeu56WX+x+aem172296XCz/ZbjrY6+BX3n+l37L972un3ljv+dGwOLBvruLr57/17cPel93v3RB6kPXj/Mejj9aP1j7OOiJwpPKp6qP6391fjXZqm99Oyg12DPs4hnj4a4Qy//lfmvT8MFz6nPK0a0RupHrUfPjPmM3Xqx9MXwy4yX0+OFvyn+tveV0auffnf7vWdiycTwa9HrmT9K3qi+OfrW9m3nZOjk03dp76anit6rvj/2gf2h+2P0x5Hp7E/4T5WfjT93fAn88ngmbWbm3/eE8/syOll+AAAACXBIWXMAAAsTAAALEwEAmpwYAAAEImlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iCiAgICAgICAgICAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgICAgICAgICAgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIj4KICAgICAgICAgPHRpZmY6UmVzb2x1dGlvblVuaXQ+MTwvdGlmZjpSZXNvbHV0aW9uVW5pdD4KICAgICAgICAgPHRpZmY6Q29tcHJlc3Npb24+NTwvdGlmZjpDb21wcmVzc2lvbj4KICAgICAgICAgPHRpZmY6WFJlc29sdXRpb24+NzI8L3RpZmY6WFJlc29sdXRpb24+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgICAgIDx0aWZmOllSZXNvbHV0aW9uPjcyPC90aWZmOllSZXNvbHV0aW9uPgogICAgICAgICA8ZXhpZjpQaXhlbFhEaW1lbnNpb24+MzI8L2V4aWY6UGl4ZWxYRGltZW5zaW9uPgogICAgICAgICA8ZXhpZjpDb2xvclNwYWNlPjE8L2V4aWY6Q29sb3JTcGFjZT4KICAgICAgICAgPGV4aWY6UGl4ZWxZRGltZW5zaW9uPjIwPC9leGlmOlBpeGVsWURpbWVuc2lvbj4KICAgICAgICAgPGRjOnN1YmplY3Q+CiAgICAgICAgICAgIDxyZGY6QmFnLz4KICAgICAgICAgPC9kYzpzdWJqZWN0PgogICAgICAgICA8eG1wOk1vZGlmeURhdGU+MjAxNS0wNi0xNFQxOTowNjo1OTwveG1wOk1vZGlmeURhdGU+CiAgICAgICAgIDx4bXA6Q3JlYXRvclRvb2w+UGl4ZWxtYXRvciAzLjI8L3htcDpDcmVhdG9yVG9vbD4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+Ch7v5WoAAAGgSURBVEgNYywtLbVnYmLqYmBgMANieoJT//79K2MBWr4CaKsEPW2G2mUGspsFZnlnZycjPR1RXl7+H2Q3Ez0txWbXgDsAFAUYABo8YPH////HdXV1LUZWVFZWFsvIyLgIJoYt+pDNwCYP00swBIAWzaysrNSCaQCxgWLTYHxKaawhgGYoJzC7rC4sLDQBiYPYQIoHTQ3ZXGIcADJci42NDeZreGiQbSuSRmKiABb/CUB9IMwAjAKYGIhLESAYAj9//kwH+t4YaAvM59c4ODiyvn//HotuMzDh9QLFirCIg/I8CPQBE2QxhAkhCYZAf3//d2CJFQpU/h2EQeyGhoYvyIbA2FDDl8H4aPQydMtB8gQdAFLU3t5+DRjsWSAMYoPEcAFOTs5EoNw+NPl9UHE0YQYGglEA09HR0bEAxsZHA0PnFzAqgoBq9gIxKOrOAnEQSBxIYwCiQgBDFwEBYFB/BEaVJ7AQ2wGiQXxcWhhhJRZQ0UBURsSlAVyup4Y4TaKAFIeBouAJUIM0KZqoqPYpEzBrpQANfEFFQ4k16gXIbgCggnKoJ5DJdwAAAABJRU5ErkJggg==\" alt=\"MD Logo\" /> and text</a></p>"
  },
  {
    "path": "test/data/inline_link_title.html",
    "content": "<p><a href=\"http://example.com\" title=\"Title\">single quotes</a></p>\n<p><a href=\"http://example.com\" title=\"Title\">double quotes</a></p>\n<p><a href=\"http://example.com\" title=\"\">single quotes blank</a></p>\n<p><a href=\"http://example.com\" title=\"\">double quotes blank</a></p>\n<p><a href=\"http://example.com\" title=\"2 Words\">space</a></p>\n<p><a href=\"http://example.com/url-(parentheses)\" title=\"Title\">parentheses</a></p>"
  },
  {
    "path": "test/data/inline_title.html",
    "content": "<p><a href=\"http://example.com\" title=\"Example\">single quotes</a> and <a href=\"http://example.com\" title=\"Example\">double quotes</a></p>"
  },
  {
    "path": "test/data/lazy_blockquote.html",
    "content": "<blockquote>\n<p>quote\nthe rest of it</p>\n</blockquote>\n<blockquote>\n<p>another paragraph\nthe rest of it</p>\n</blockquote>"
  },
  {
    "path": "test/data/lazy_list.html",
    "content": "<ul>\n<li>li\nthe rest of it</li>\n</ul>"
  },
  {
    "path": "test/data/line_break.html",
    "content": "<p>line<br />\nline</p>"
  },
  {
    "path": "test/data/markup_consecutive_one.html",
    "content": "<div>Markup</div>\n_No markdown_ without blank line for **strict** compliance with CommonMark.\n<p><strong>Markdown</strong></p>"
  },
  {
    "path": "test/data/markup_consecutive_one_line.html",
    "content": "<div>One markup on\ntwo lines</div>\n_No markdown_\n<p><strong>Markdown</strong></p>"
  },
  {
    "path": "test/data/markup_consecutive_one_stripped.html",
    "content": "<div><p>Stripped markup</p></div>\n_No markdown_\n<p><strong>Markdown</strong></p>"
  },
  {
    "path": "test/data/markup_consecutive_two.html",
    "content": "<div>First markup</div><p>and second markup on the same line.</p>\n_No markdown_\n<p><strong>Markdown</strong></p>"
  },
  {
    "path": "test/data/markup_consecutive_two_lines.html",
    "content": "<div>First markup</div><p>and partial markup\non two lines.</p>\n_No markdown_\n<p><strong>Markdown</strong></p>"
  },
  {
    "path": "test/data/markup_consecutive_two_stripped.html",
    "content": "<div><p>Stripped markup\non two lines</p></div>\n_No markdown_\n<p><strong>Markdown</strong></p>"
  },
  {
    "path": "test/data/multiline_list_paragraph.html",
    "content": "<ul>\n<li>\n<p>li</p>\n<p>line\nline</p>\n</li>\n</ul>"
  },
  {
    "path": "test/data/multiline_lists.html",
    "content": "<ol>\n<li>\n<p>One\nFirst body copy</p>\n</li>\n<li>\n<p>Two\nLast body copy</p>\n</li>\n</ol>"
  },
  {
    "path": "test/data/nested_block-level_html.html",
    "content": "<div>\n_parent_\n<div>\n_child_\n</div>\n<pre>\n_adopted child_\n</pre>\n</div>\n<p><em>outside</em></p>"
  },
  {
    "path": "test/data/ordered_list.html",
    "content": "<ol>\n<li>one</li>\n<li>two</li>\n</ol>\n<p>repeating numbers:</p>\n<ol>\n<li>one</li>\n<li>two</li>\n</ol>\n<p>large numbers:</p>\n<ol start=\"123\">\n<li>one</li>\n</ol>\n<p>foo 1. the following should not start a list\n100.<br />\n200. </p>"
  },
  {
    "path": "test/data/paragraph_list.html",
    "content": "<p>paragraph</p>\n<ul>\n<li>li</li>\n<li>li</li>\n</ul>\n<p>paragraph</p>\n<ul>\n<li>\n<p>li</p>\n</li>\n<li>\n<p>li</p>\n</li>\n</ul>"
  },
  {
    "path": "test/data/reference_title.html",
    "content": "<p><a href=\"http://example.com\" title=\"example title\">double quotes</a> and <a href=\"http://example.com\" title=\"example title\">single quotes</a> and <a href=\"http://example.com\" title=\"example title\">parentheses</a></p>\n<p>[invalid title]: <a href=\"http://example.com\">http://example.com</a> example title</p>"
  },
  {
    "path": "test/data/self-closing_html.html",
    "content": "<hr>\n<p>paragraph</p>\n<hr/>\n<p>paragraph</p>\n<hr />\n<p>paragraph</p>\n<hr class=\"foo\" id=\"bar\" />\n<p>paragraph</p>\n<hr class=\"foo\" id=\"bar\"/>\n<p>paragraph</p>\n<hr class=\"foo\" id=\"bar\" >\n<p>paragraph</p>"
  },
  {
    "path": "test/data/separated_nested_list.html",
    "content": "<ul>\n<li>\n<p>li</p>\n<ul>\n<li>li</li>\n<li>li</li>\n</ul>\n</li>\n</ul>"
  },
  {
    "path": "test/data/setext_header.html",
    "content": "<h1>h1</h1>\n<h2>h2</h2>\n<h2>single character</h2>\n<p>not a header</p>\n<hr />"
  },
  {
    "path": "test/data/setext_header_spaces.html",
    "content": "<h1>trailing space</h1>\n<h2>trailing space</h2>\n<h1>leading and trailing space</h1>\n<h2>leading and trailing space</h2>\n<h1>1 leading space</h1>\n<h2>1 leading space</h2>\n<h1>3 leading spaces</h1>\n<h2>3 leading spaces</h2>\n<p>too many leading spaces\n==</p>\n<p>too many leading spaces\n--</p>"
  },
  {
    "path": "test/data/simple_blockquote.html",
    "content": "<blockquote>\n<p>quote</p>\n</blockquote>\n<p>indented:</p>\n<blockquote>\n<p>quote</p>\n</blockquote>\n<p>no space after <code>&gt;</code>:</p>\n<blockquote>\n<p>quote</p>\n</blockquote>\n<hr />\n<blockquote>\n<blockquote>\n<blockquote>\n<p>Info 1 text</p>\n</blockquote>\n</blockquote>\n</blockquote>\n<blockquote>\n<blockquote>\n<blockquote>\n<p>Info 2 text</p>\n</blockquote>\n</blockquote>\n</blockquote>"
  },
  {
    "path": "test/data/simple_table.html",
    "content": "<table>\n<thead>\n<tr>\n<th>header 1</th>\n<th>header 2</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>cell 1.1</td>\n<td>cell 1.2</td>\n</tr>\n<tr>\n<td>cell 2.1</td>\n<td>cell 2.2</td>\n</tr>\n</tbody>\n</table>\n<hr />\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">header 1</th>\n<th>header 2</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">cell 1.1</td>\n<td>cell 1.2</td>\n</tr>\n<tr>\n<td style=\"text-align: left;\">cell 2.1</td>\n<td>cell 2.2</td>\n</tr>\n</tbody>\n</table>\n<hr />\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">header 1</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">cell 1.1</td>\n</tr>\n<tr>\n<td style=\"text-align: left;\">cell 2.1</td>\n</tr>\n</tbody>\n</table>\n<hr />\n<table>\n<thead>\n<tr>\n<th>header 1</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>cell 1.1</td>\n</tr>\n<tr>\n<td>cell 2.1</td>\n</tr>\n</tbody>\n</table>\n<hr />\n<p>Not a table, we haven't ended the paragraph:\nheader 1 | header 2\n-------- | --------\ncell 1.1 | cell 1.2\ncell 2.1 | cell 2.2</p>"
  },
  {
    "path": "test/data/span-level_html.html",
    "content": "<p>an <b>important</b> <a href=''>link</a></p>\n<p>broken<br/>\nline</p>\n<p><b>inline tag</b> at the beginning</p>\n<p><span><a href=\"http://example.com\">http://example.com</a></span></p>"
  },
  {
    "path": "test/data/sparse_dense_list.html",
    "content": "<ul>\n<li>\n<p>li</p>\n</li>\n<li>\n<p>li</p>\n</li>\n<li>\n<p>li</p>\n</li>\n</ul>"
  },
  {
    "path": "test/data/sparse_html.html",
    "content": "<div>\nline 1\n<p>line 2\nline 3</p>\n<p>line 4</p>\n</div>"
  },
  {
    "path": "test/data/sparse_list.html",
    "content": "<ul>\n<li>\n<p>li</p>\n</li>\n<li>\n<p>li</p>\n</li>\n</ul>\n<hr />\n<ul>\n<li>\n<p>li</p>\n<ul>\n<li>indented li</li>\n</ul>\n</li>\n</ul>"
  },
  {
    "path": "test/data/special_characters.html",
    "content": "<p>AT&amp;T has an ampersand in their name</p>\n<p>this &amp; that</p>\n<p>4 &lt; 5 and 6 &gt; 5</p>\n<p><a href=\"http://example.com/autolink?a=1&amp;b=2\">http://example.com/autolink?a=1&amp;b=2</a></p>\n<p><a href=\"/script?a=1&amp;b=2\">inline link</a></p>\n<p><a href=\"http://example.com/?a=1&amp;b=2\">reference link</a></p>"
  },
  {
    "path": "test/data/strict_atx_heading.html",
    "content": "<h1>h1</h1>\n<h2>h2</h2>\n<h3>h3</h3>\n<h4>h4</h4>\n<h5>h5</h5>\n<h6>h6</h6>\n<p>####### not a heading</p>\n<p>#not a heading</p>\n<h1>closed h1</h1>\n<h1></h1>\n<h2></h2>\n<h1># of levels</h1>\n<h1># of levels #</h1>"
  },
  {
    "path": "test/data/strikethrough.html",
    "content": "<p><del>strikethrough</del></p>\n<p>here's <del>one</del> followed by <del>another one</del></p>\n<p>~~ this ~~ is not one neither is ~this~</p>\n<p>escaped ~~this~~</p>"
  },
  {
    "path": "test/data/strong_em.html",
    "content": "<p><em>em <strong>strong em</strong></em></p>\n<p><em><strong>strong em</strong> em</em></p>\n<p><em>em <strong>strong em</strong> em</em></p>\n<p><em>em <strong>strong em</strong></em></p>\n<p><em><strong>strong em</strong> em</em></p>\n<p><em>em <strong>strong em</strong> em</em></p>"
  },
  {
    "path": "test/data/tab-indented_code_block.html",
    "content": "<pre><code>&lt;?php\n\n$message = 'Hello World!';\necho $message;\n\necho \"following a blank line\";</code></pre>"
  },
  {
    "path": "test/data/table_inline_markdown.html",
    "content": "<table>\n<thead>\n<tr>\n<th><em>header</em> 1</th>\n<th>header 2</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><em>cell</em> 1.1</td>\n<td><del>cell</del> 1.2</td>\n</tr>\n<tr>\n<td><code>|</code> 2.1</td>\n<td>| 2.2</td>\n</tr>\n<tr>\n<td><code>\\|</code> 2.1</td>\n<td><a href=\"/\">link</a></td>\n</tr>\n</tbody>\n</table>"
  },
  {
    "path": "test/data/text_reference.html",
    "content": "<p><a href=\"http://example.com\">reference link</a></p>\n<p><a href=\"http://example.com\">one</a> with a semantic name</p>\n<p>[one][404] with no definition</p>\n<p><a href=\"http://example.com\">multiline\none</a> defined on 2 lines</p>\n<p><a href=\"http://example.com\">one</a> with a mixed case label and an upper case definition</p>\n<p><a href=\"http://example.com\">one</a> with the a label on the next line</p>\n<p><a href=\"http://example.com\"><code>link</code></a></p>"
  },
  {
    "path": "test/data/unordered_list.html",
    "content": "<ul>\n<li>li</li>\n<li>li</li>\n</ul>\n<p>mixed unordered markers:</p>\n<ul>\n<li>li</li>\n</ul>\n<ul>\n<li>li</li>\n</ul>\n<ul>\n<li>li</li>\n</ul>\n<p>mixed ordered markers:</p>\n<ol>\n<li>starting at 1, list one</li>\n<li>number 2, list one</li>\n</ol>\n<ol start=\"3\">\n<li>starting at 3, list two</li>\n</ol>"
  },
  {
    "path": "test/data/untidy_table.html",
    "content": "<table>\n<thead>\n<tr>\n<th>header 1</th>\n<th>header 2</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>cell 1.1</td>\n<td>cell 1.2</td>\n</tr>\n<tr>\n<td>cell 2.1</td>\n<td>cell 2.2</td>\n</tr>\n</tbody>\n</table>"
  },
  {
    "path": "test/data/url_autolinking.html",
    "content": "<p>an autolink <a href=\"http://example.com\">http://example.com</a></p>\n<p>inside of brackets [<a href=\"http://example.com\">http://example.com</a>], inside of braces {<a href=\"http://example.com\">http://example.com</a>},  inside of parentheses (<a href=\"http://example.com\">http://example.com</a>)</p>\n<p>trailing slash <a href=\"http://example.com/\">http://example.com/</a> and <a href=\"http://example.com/path/\">http://example.com/path/</a></p>"
  },
  {
    "path": "test/data/whitespace.html",
    "content": "<pre><code>code</code></pre>"
  },
  {
    "path": "test/data/xss_attribute_encoding.html",
    "content": "<p><a href=\"https://www.example.com&quot;\">xss</a></p>\n<p><img src=\"https://www.example.com&quot;\" alt=\"xss\" /></p>\n<p><a href=\"https://www.example.com&#039;\">xss</a></p>\n<p><img src=\"https://www.example.com&#039;\" alt=\"xss\" /></p>\n<p><img src=\"https://www.example.com\" alt=\"xss&quot;\" /></p>\n<p><img src=\"https://www.example.com\" alt=\"xss&#039;\" /></p>"
  },
  {
    "path": "test/data/xss_bad_url.html",
    "content": "<p><a href=\"javascript%3Aalert(1)\">xss</a></p>\n<p><a href=\"javascript%3Aalert(1)\">xss</a></p>\n<p><a href=\"javascript%3A//alert(1)\">xss</a></p>\n<p><a href=\"javascript&amp;colon;alert(1)\">xss</a></p>\n<p><img src=\"javascript%3Aalert(1)\" alt=\"xss\" /></p>\n<p><img src=\"javascript%3Aalert(1)\" alt=\"xss\" /></p>\n<p><img src=\"javascript%3A//alert(1)\" alt=\"xss\" /></p>\n<p><img src=\"javascript&amp;colon;alert(1)\" alt=\"xss\" /></p>\n<p><a href=\"data%3Atext/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==\">xss</a></p>\n<p><a href=\"data%3Atext/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==\">xss</a></p>\n<p><a href=\"data%3A//text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==\">xss</a></p>\n<p><a href=\"data&amp;colon;text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==\">xss</a></p>\n<p><img src=\"data%3Atext/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==\" alt=\"xss\" /></p>\n<p><img src=\"data%3Atext/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==\" alt=\"xss\" /></p>\n<p><img src=\"data%3A//text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==\" alt=\"xss\" /></p>\n<p><img src=\"data&amp;colon;text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==\" alt=\"xss\" /></p>"
  },
  {
    "path": "test/data/xss_text_encoding.html",
    "content": "<p>&lt;script&gt;alert(1)&lt;/script&gt;</p>\n<p>&lt;script&gt;</p>\n<p>alert(1)</p>\n<p>&lt;/script&gt;</p>\n<p>&lt;script&gt;\nalert(1)\n&lt;/script&gt;</p>"
  }
]