github-markdown-html
raw JSON → 4.1.0 verified Sat Apr 25 auth: no javascript
Markdown to HTML converter that uses webpack to process markdown files, highlight code blocks, and embed GitHub-like styles via github-markdown-css. Version 4.1.0 is stable with a low release cadence. It distinguishes itself by bundling all transformation steps into a single webpack pipeline, making it easy to generate a styled HTML page from a README.md with a single command.
Common errors
error Error: Cannot find module 'github-markdown-html' ↓
cause Package is not installed or not in the current project's node_modules.
fix
Run npm install github-markdown-html or install globally with npm install -g github-markdown-html.
error github-markdown-html: command not found ↓
cause CLI binary is not in PATH (global install issue or not installed globally).
fix
Install globally: npm install -g github-markdown-html, or use npx: npx github-markdown-html build.
error TypeError: githubMarkdownHtml is not a function ↓
cause Default import is used incorrectly; the package exports an object with methods, not a direct function.
fix
Use named imports: import { build } from 'github-markdown-html'; then call build().
Warnings
gotcha Running the CLI command without installing globally may fail if the package is not in PATH. ↓
fix Install globally with npm install -g github-markdown-html or use npx github-markdown-html build.
deprecated The package is low-maintenance and may rely on older webpack versions. ↓
fix Consider alternatives like marked with highlight.js or a custom webpack setup.
breaking Version 4.0.0 introduced named exports (build, dev) and changed the default export behavior. ↓
fix Update imports: use import { build } from 'github-markdown-html' instead of require('github-markdown-html').build().
gotcha The CLI expects a README.md in the current directory; if not present, the build fails silently. ↓
fix Ensure a README.md exists in the working directory before running the command.
gotcha The generated index.html is overwritten without warning; custom changes will be lost. ↓
fix Use a separate output directory or version control to preserve custom HTML files.
deprecated github-markdown-css is used but may not be kept up-to-date with GitHub's latest styles. ↓
fix Customize styles with your own CSS file or replace github-markdown-css with a more recent alternative.
gotcha The html-webpack-uncss-plugin may remove CSS that is dynamically added by JavaScript; test carefully. ↓
fix Disable the plugin or configure it to whitelist necessary classes if dynamic content is missing styles.
Install
npm install github-markdown-html yarn add github-markdown-html pnpm add github-markdown-html Imports
- main wrong
const githubMarkdownHtml = require('github-markdown-html')correctimport githubMarkdownHtml from 'github-markdown-html' - build
import { build } from 'github-markdown-html' - dev
import { dev } from 'github-markdown-html' - default wrong
import { default as githubMarkdownHtml } from 'github-markdown-html'correctimport githubMarkdownHtml from 'github-markdown-html'
Quickstart
// Install globally
npm install -g github-markdown-html
// Navigate to a directory with a README.md and run:
github-markdown-html build
// This creates an index.html with GitHub-styled markdown.
// For programmatic usage:
import githubMarkdownHtml from 'github-markdown-html';
import { build } from 'github-markdown-html';
// Or in CommonJS:
const githubMarkdownHtml = require('github-markdown-html');
const { build } = require('github-markdown-html');