When building markdown which contains a code block which is part of a list item, like this:
1. First install this thing.
2. Then do this:
```js
const thing = require('installed-thing')
Then start the app.
This plugin will currently cause the gatsby build to fail with:
TypeError: Cannot read property 'replace' of undefined
This is happening because the current implementation of the visit handler assumes that every code block is a top-level node in the AST. The problem can be fixed by updating the visit handler to take a third parent argument and then, within the implementation of the handler, use parent.children instead of markdownAST.children.
When building markdown which contains a code block which is part of a list item, like this:
This plugin will currently cause the gatsby build to fail with:
This is happening because the current implementation of the
visit
handler assumes that every code block is a top-level node in the AST. The problem can be fixed by updating thevisit
handler to take a thirdparent
argument and then, within the implementation of the handler, useparent.children
instead ofmarkdownAST.children
.