javiercf / react-markdown-loader

This loader parses markdown files and converts them to a React Stateless Component. It will also parse FrontMatter to import dependencies and render components along with it’s source code. We developed this loader in order to make the process of creating styleguides for React components easier
145 stars 33 forks source link

Markdown is applied as `string` #3

Closed frenic closed 8 years ago

frenic commented 8 years ago

The markdown markup is returned as string with Webpack 2.

module.exports = function (context) {
  return function () {
    if (!React) {
      var React = __webpack_require__(/*! react */ 85);
    }

    return React.createElement(
      "div",
      null,
      React.createElement(
        "p",
        null,
        "module.exports = \"<h1 id=\\\"testing-en\\\">Testing EN</h1>\\n<p>Weeeeii! It's working!</p>\\n\";"
      )
    );
  }.apply(context);
};

What's rendered to my DOM is:

<p>module.exports = "&lt;hr&gt;\n&lt;h2 id=\"componentname-svtest\"&gt;componentName: SvTest&lt;/h2&gt;\n&lt;h1 id=\"testar-sv\"&gt;Testar SV&lt;/h1&gt;\n&lt;p&gt;Weeeeii! Det fungerar!&lt;/p&gt;\n";</p>

My markdown-file is imported using import-statement and is just containing:

# Testing EN
Weeeeii! It's working!

What am I doing wrong?

frenic commented 8 years ago

Sorry, my bad. Had double loaders for /.md$/.