Registry / http-networking / markdown-loader

markdown-loader

JSON →
library8.0.0jsnpmunverified

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.

npm install markdown-loader
INSTALL
IMPORT
SIG · MARKDOWN-LOADER
M
markdown-loader
http-networkingjavascriptv8.0.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (rule use entry)
✓ use: [{ loader: 'html-loader' }, { loader: 'markdown-loader', options: {} }]
✗ use: 'markdown-loader'
Must be chained before html-loader; using markdown-loader alone outputs raw HTML string, which webpack expects as module export.
rules config
✓ module.exports = { module: { rules: [ { test: /\.md$/, use: [ ... ] } ] } }
✗ require('markdown-loader'); // cannot be used programmatically
markdown-loader is a webpack loader, not a standalone function. Use only inside webpack config.
options passed to marked
✓ { loader: 'markdown-loader', options: { headerIds: false } }
✗ { loader: 'markdown-loader', query: '?headerIds=false' }
Options object is passed directly to marked. Do not use query string syntax.

Shows minimal webpack config to load .md files through markdown-loader and html-loader.

// webpack.config.js const config = { module: { rules: [ { test: /\.md$/, use: [ { loader: 'html-loader' }, { loader: 'markdown-loader', options: { // Marked options: https://marked.js.org/using_advanced#options headerIds: false, gfm: true } } ] } ] } }; export default config;
Debug
Known issues
breakingv8.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.
fix
Ensure each rule's options are independent. Previously shared state may have caused unexpected behavior.
affects: >=8.0.0
deprecatedv6.0.0 dropped Node v6 support; v5.2.0 deprecated for removing Node v6 support without a major version.
fix
Upgrade to v8.0.0 or later if using Node >=12.22.9. For older Node, stay on v5.1.0.
affects: >=5.2.0 <6.0.0
gotchamarkdown-loader outputs HTML string, not a module. Without html-loader, the HTML will be treated as an unexpected module export.
fix
Always use html-loader after markdown-loader in the loader chain.
affects: >=0.0.0
gotchaOptions object is passed directly to marked; invalid options will crash the build.
fix
Refer to marked documentation for valid options. Use a parse function in marked's options if advanced customization is needed.
affects: >=0.0.0
gotchaThe loader is not designed for server-side rendering or direct HTML manipulation outside webpack.
fix
For standalone markdown-to-HTML conversion, use marked directly instead.
affects: >=0.0.0
Errors
Common errors & fixes
Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type.
markdown-loader not properly configured in webpack rules.
fix
Add a rule with test: /\.md$/ and use markdown-loader and html-loader.
Error: Cannot find module 'marked'
missing marked dependency (markdown-loader uses marked under the hood but does not install it as a dependency).
fix
npm install marked
webpack 4 compatibility: markdown-loader v8 requires webpack 5.
markdown-loader v8 declares webpack ^5.0.0 as peer dependency.
fix
Either use markdown-loader v7 or earlier for webpack 4, or upgrade to webpack 5.
Upgrade
Version history
8.0.0latest on npm
Audit
Dependencies
webpackrequiredPeer dependency: loader runs in webpack build pipeline
Agent activity
4 hits · last 30 days
node
4
Resources
markdown-loader — npm install markdown-loader · libregistry