Skip to content

Commit 54e5a63

Browse files
committed
Only visit inlineCode nodes if inlineCode is defined
1 parent 926d36b commit 54e5a63

File tree

3 files changed

+66
-1
lines changed

3 files changed

+66
-1
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function createPlugin() {
6666
const nodes = [];
6767
visit(
6868
markdownAST,
69-
({ type }) => type === 'code' || type === 'inlineCode',
69+
({ type }) => type === 'code' || inlineCode && type === 'inlineCode',
7070
node => {
7171
nodes.push(node);
7272
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<h1>TypeError: Cannot read property 'marker' of undefined</h1>
2+
<p>After updating to <code>v2.1.0</code> I am now getting this error.</p>
3+
<p>My gatsby-config.js file looks like this:</p>
4+
<pre class="grvsc-container default-dark" data-language="js" data-index="0"><code class="grvsc-code"><span class="grvsc-line"><span class="mtk1">{</span></span>
5+
<span class="grvsc-line"><span class="mtk1"> resolve: </span><span class="mtk8">"gatsby-remark-vscode"</span><span class="mtk1">,</span></span>
6+
<span class="grvsc-line"><span class="mtk1"> options: {</span></span>
7+
<span class="grvsc-line"><span class="mtk1"> theme: </span><span class="mtk8">"Shades of Purple"</span><span class="mtk1">,</span></span>
8+
<span class="grvsc-line"><span class="mtk1"> extensions: [</span><span class="mtk8">"shades-of-purple"</span><span class="mtk1">],</span></span>
9+
<span class="grvsc-line"><span class="mtk1"> },</span></span>
10+
<span class="grvsc-line"><span class="mtk1">},</span></span></code></pre>
11+
<style class="grvsc-styles">
12+
.grvsc-container {
13+
overflow: auto;
14+
-webkit-overflow-scrolling: touch;
15+
padding-top: 1rem;
16+
padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));
17+
padding-bottom: 1rem;
18+
padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));
19+
border-radius: 8px;
20+
border-radius: var(--grvsc-border-radius, 8px);
21+
font-feature-settings: normal;
22+
}
23+
24+
.grvsc-code {
25+
display: inline-block;
26+
min-width: 100%;
27+
}
28+
29+
.grvsc-line {
30+
display: inline-block;
31+
box-sizing: border-box;
32+
width: 100%;
33+
padding-left: 1.5rem;
34+
padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));
35+
padding-right: 1.5rem;
36+
padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));
37+
}
38+
39+
.grvsc-line-highlighted {
40+
background-color: var(--grvsc-line-highlighted-background-color, transparent);
41+
box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);
42+
}
43+
44+
.default-dark {
45+
background-color: #1E1E1E;
46+
color: #D4D4D4;
47+
}
48+
.default-dark .mtk1 { color: #D4D4D4; }
49+
.default-dark .mtk8 { color: #CE9178; }
50+
</style>

test/integration/cases/bug-93/test.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# TypeError: Cannot read property 'marker' of undefined
2+
3+
After updating to `v2.1.0` I am now getting this error.
4+
5+
My gatsby-config.js file looks like this:
6+
7+
```js
8+
{
9+
resolve: "gatsby-remark-vscode",
10+
options: {
11+
theme: "Shades of Purple",
12+
extensions: ["shades-of-purple"],
13+
},
14+
},
15+
```

0 commit comments

Comments
 (0)