react-markdown-loader
react-markdown-loader copied to clipboard
Invalid babel syntax
I'd like to display some code samples within the page, not actually render it. But I'm getting an error.
I'm not quite sure if the problem is in this loader or not. When I add the following to a markdown file that is processed through this loader and then through babel, I get a BabelLoaderError: SyntaxError: Unexpected token (46:227)
error.
```js
function Sample () {
return 'hi'
}
```
Here is the full error:
ERROR in ./src/elements/Hello/readme.md
Module build failed: SyntaxError: Unexpected token (46:227)
44 | </code></pre>
45 | </div>
> 46 | </div><pre><code className="language-js"><span className="token keyword" >function</span> Sample <span className="token punctuation" >(</span><span className="token punctuation" >)</span> <span className="token punctuation" >{</span>
| ^
47 | <span className="token keyword" >return</span> <span className="token string" >'hi'</span>
48 | <span className="token punctuation" >}</span>
49 | </code></pre>
BabelLoaderError: SyntaxError: Unexpected token (46:227)
44 | </code></pre>
45 | </div>
> 46 | </div><pre><code className="language-js"><span className="token keyword" >function</span> Sample <span className="token punctuation" >(</span><span className="token punctuation" >)</span> <span className="token punctuation" >{</span>
| ^
47 | <span className="token keyword" >return</span> <span className="token string" >'hi'</span>
48 | <span className="token punctuation" >}</span>
49 | </code></pre>
at transpile (/Users/tauren/repos/component-lab/node_modules/babel-loader/lib/index.js:61:13)
at Object.module.exports (/Users/tauren/repos/component-lab/node_modules/babel-loader/lib/index.js:155:20)
@ ./src/elements/index.js 14:0-44
@ ./src/app/Main/index.js
@ ./src/app/App/index.js
@ ./src/app/Root/index.js
@ ./src/index.js
@ multi ./~/react-hot-loader/patch.js ./~/babel-polyfill/lib/index.js ./src/index.js webpack-dev-server/client?http://localhost:5000/ webpack/hot/dev-server
same here....
same here ... @tauren @FrendKao How did you solve this problem?
Having the same problem, I chose this project because it supports code highlighting, but not being able to use braces is a major issue right now.
solved, by switching to jsxtreme-markdown-loader relevant gist: https://gist.github.com/alexvish/73a52e03ddd7919da3eb1dfd2630493a