egoist/docute

Do you want to work on this issue?

You can request for a bounty in order to promote it!

Cannot read property 'highlight' of undefined - when using an indented code block #179

wsw70 posted onGitHub

This bug was initially submitted with marked.js (https://github.com/markedjs/marked/issues/1348) but it seems the problem is finally with Docute. Please also see the comment at https://github.com/markedjs/marked/issues/1348#issuecomment-426269743

Description

Using the example HTML file with a specific README.md, the site is not rendered and the console mentions

Uncaught (in promise) TypeError: Cannot read property 'highlight' of undefined
Please report this to https://github.com/markedjs/marked.
    at U.n.code (docute.js:1)
    at V.tok (docute.js:1)
    at V.parse (docute.js:1)
    at Function.V.parse (docute.js:1)
    at rt (docute.js:1)
    at docute.js:1

Reproduction

Expose the following two files via a web server (devd in my case), the HTML file is the first example given in Docute.

The error is on the block containing code

  • index.html
<!DOCTYPE>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>My Docs</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docute@4/dist/docute.css">
  </head>
  <body>
    <div id="docute"></div>
    <script src="https://cdn.jsdelivr.net/npm/docute@4/dist/docute.js"></script>
    <script>
      new Docute({
        target: '#docute'
      })
    </script>
  </body>
</html>
  • README.md (please take the source code, as the version below is rendered by GitHub and i do not know how to make it raw (non-rendered) data)

--- snip --- text

code

text --- snip ---


Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests