iamskok / gatsby-remark-code-buttons

Buttons for code snippets 🔘
https://gatsby-dev-blog-starter.netlify.com/blog/building-your-first-react-app
19 stars 9 forks source link

HTML page not rendering. #4

Closed Blackglade closed 5 years ago

Blackglade commented 5 years ago

I have a markdown file that gives me an error everytime I try to render the page. The error is something along the lines of:

  Cannot read property 'value' of undefined

  GraphQL request:20:5
  19 |   markdownRemark(fields: {url: {eq: $url}}) {
  20 |     html

Here's a snippet of the markdown file that seems to be causing this issue. I can't seem to paste it here without GitHub's markdown engine rendering it so here: https://pastebin.com/raw/chCaM7EK

I tried querying this markdown file's html via GraphQL to see what is going on and I got this issue and it seems to be isolated to the gatsby-remark-code-buttons plugin. Removing this plugin seems to resolve the issue.

  "message": "Cannot read property 'value' of undefined",
      "locations": [
        {
          "line": 3,
          "column": 6
        }
      ],
      "path": [
        "markdownRemark",
        "html"
      ],
      "stack": [
        "TypeError: Cannot read property 'value' of undefined",
        "    at /Users/harshb/Desktop/site/node_modules/gatsby-remark-code-buttons/index.js:54:46",
        "    at overload (/Users/harshb/Desktop/site/node_modules/unist-util-visit/index.js:27:12)",
        "    at one (/Users/harshb/Desktop/site/node_modules/unist-util-visit-parents/index.js:34:25)",
Blackglade commented 5 years ago

@iamskok Any chance I could get an update on this?

iamskok commented 5 years ago

@Blackglade I’m very sorry, but I don’t have capacity to look into it.

Did you come up with a solution for this issue?

Sent with GitHawk

Blackglade commented 5 years ago

@iamskok, I essentially added an extra line to resolve the issue as through some testing I found that doing this in markdown:

- Some bulleted text `<statement>`:
\```
<arbitrary code here> 
\```

will cause the bug to flair up. (ignore the back slashes btw, that's so the markdown code chunk properly renders. But adding an extra line between the bulleted section and code chunk will resolve it:

- Some bulleted text `<statement>`:

\```
<arbitrary code here> 
\```
Blackglade commented 5 years ago

Still no idea why this is happening, but we've only had the one occurrence of this pop up. If it pops up again, I will probably go deeper into the issue and potentially submit a PR to fix it.

iamskok commented 5 years ago

@Blackglade Feel free to reopen this issue