Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wsw70 opened this issue Oct 2, 2018 · 4 comments

Comments

@wsw70
Copy link

wsw70 commented Oct 2, 2018

This bug was initially submitted with marked.js (markedjs/marked#1348) but it seems the problem is finally with Docute. Please also see the comment at markedjs/marked#1348 (comment)

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 ---

@wsw70 wsw70 changed the title Cannot read property 'highlight' of undefined Cannot read property 'highlight' of undefined - when using an indented code block Oct 2, 2018
@wsw70
Copy link
Author

wsw70 commented Oct 2, 2018

Please let me know if the landing place of the bug is correct or not.

@styfle
Copy link

styfle commented Oct 2, 2018

My guess is that the problem lies in the /src/utils/markedRenderer.js file since it overrides marked's renderer.

@egoist
Copy link
Owner

egoist commented Oct 3, 2018

which version are you using? it is supposed to be fixed in 4.0.7

@wsw70
Copy link
Author

wsw70 commented Oct 3, 2018

@egoist I use the one from the example HTML (https://cdn.jsdelivr.net/npm/docute@4/dist/docute.js). At the end of that file (it is minified so I am not sure where to look) I see er.version="4.0.6"

On the other hand

$ npm view docute version
4.0.7

so I will be better off using an installed version (which leaves the question of the CSS open but it is another problem)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants