{"id":21552,"library":"markdown-loader","title":"markdown-loader","description":"webpack loader that converts Markdown files into HTML using the marked library. v8.0.0 (Jan 2022) requires Node >=12.22.9 and webpack ^5.0.0. Released under semantic-release with monthly downloads ~1M. Typically used together with html-loader to handle the HTML output. Alternatives include markdown-to-html-loader or custom markdown handling, but this is a simple, focused loader that directly wraps marked.","status":"active","version":"8.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/peerigon/markdown-loader","tags":["javascript","webpack","plugin","markdown","html"],"install":[{"cmd":"npm install markdown-loader","lang":"bash","label":"npm"},{"cmd":"yarn add markdown-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add markdown-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: loader runs in webpack build pipeline","package":"webpack","optional":false}],"imports":[{"note":"Must be chained before html-loader; using markdown-loader alone outputs raw HTML string, which webpack expects as module export.","wrong":"use: 'markdown-loader'","symbol":"default (rule use entry)","correct":"use: [{ loader: 'html-loader' }, { loader: 'markdown-loader', options: {} }]"},{"note":"markdown-loader is a webpack loader, not a standalone function. Use only inside webpack config.","wrong":"require('markdown-loader'); // cannot be used programmatically","symbol":"rules config","correct":"module.exports = { module: { rules: [ { test: /\\.md$/, use: [ ... ] } ] } }"},{"note":"Options object is passed directly to marked. Do not use query string syntax.","wrong":"{ loader: 'markdown-loader', query: '?headerIds=false' }","symbol":"options passed to marked","correct":"{ loader: 'markdown-loader', options: { headerIds: false } }"}],"quickstart":{"code":"// webpack.config.js\nconst config = {\n  module: {\n    rules: [\n      {\n        test: /\\.md$/,\n        use: [\n          { loader: 'html-loader' },\n          {\n            loader: 'markdown-loader',\n            options: {\n              // Marked options: https://marked.js.org/using_advanced#options\n              headerIds: false,\n              gfm: true\n            }\n          }\n        ]\n      }\n    ]\n  }\n};\nexport default config;","lang":"javascript","description":"Shows minimal webpack config to load .md files through markdown-loader and html-loader."},"warnings":[{"fix":"Ensure each rule's options are independent. Previously shared state may have caused unexpected behavior.","message":"v8.0.0: Calls to marked are now isolated; options from one rule do not affect another. May change output if multiple markdown-loader rules with different options existed before.","severity":"breaking","affected_versions":">=8.0.0"},{"fix":"Upgrade to v8.0.0 or later if using Node >=12.22.9. For older Node, stay on v5.1.0.","message":"v6.0.0 dropped Node v6 support; v5.2.0 deprecated for removing Node v6 support without a major version.","severity":"deprecated","affected_versions":">=5.2.0 <6.0.0"},{"fix":"Always use html-loader after markdown-loader in the loader chain.","message":"markdown-loader outputs HTML string, not a module. Without html-loader, the HTML will be treated as an unexpected module export.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Refer to marked documentation for valid options. Use a parse function in marked's options if advanced customization is needed.","message":"Options object is passed directly to marked; invalid options will crash the build.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"For standalone markdown-to-HTML conversion, use marked directly instead.","message":"The loader is not designed for server-side rendering or direct HTML manipulation outside webpack.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Add a rule with test: /\\.md$/ and use markdown-loader and html-loader.","cause":"markdown-loader not properly configured in webpack rules.","error":"Module parse failed: Unexpected token (1:0)\nYou may need an appropriate loader to handle this file type."},{"fix":"npm install marked","cause":"missing marked dependency (markdown-loader uses marked under the hood but does not install it as a dependency).","error":"Error: Cannot find module 'marked'"},{"fix":"Either use markdown-loader v7 or earlier for webpack 4, or upgrade to webpack 5.","cause":"markdown-loader v8 declares webpack ^5.0.0 as peer dependency.","error":"webpack 4 compatibility: markdown-loader v8 requires webpack 5."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}