
Security News
PHP Foundation Says Chainguard Broke Security Embargo Ahead of Emergency Patches
The PHP Foundation says Chainguard broke a security embargo ahead of critical RCE patches, as leaks disrupted the coordinated release.
html-md-converter
Advanced tools
A bidirectional HTML to Markdown and Markdown to HTML converter with CLI and VS Code extension support
A powerful, bidirectional converter between HTML and Markdown with both CLI and VS Code extension support.
Install globally to use from anywhere:
npm install -g html-md-converter
Or use locally in your project:
npm install html-md-converter
Search for "HTML-Markdown Converter" in the VS Code Extensions marketplace, or install from the command palette:
Cmd+Shift+P (Mac) or Ctrl+Shift+P (Windows/Linux)# Convert a file
html-to-md input.html
# Specify output file
html-to-md input.html -o output.md
# Output to stdout
html-to-md input.html --stdout
# Customize heading style
html-to-md input.html --heading-style setext
# Customize code block style
html-to-md input.html --code-block-style indented
# Convert a file
md-to-html input.md
# Specify output file
md-to-html input.md -o output.html
# Output to stdout
md-to-html input.md --stdout
# Disable HTML tags in source
md-to-html input.md --no-html
# Disable automatic link detection
md-to-html input.md --no-linkify
import { htmlToMarkdown, markdownToHtml } from 'html-md-converter';
// HTML to Markdown
const html = '<h1>Hello World</h1><p>This is a paragraph.</p>';
const markdown = htmlToMarkdown(html);
console.log(markdown);
// # Hello World
//
// This is a paragraph.
// Markdown to HTML
const md = '# Hello World\n\nThis is a paragraph.';
const htmlOutput = markdownToHtml(md);
console.log(htmlOutput);
// <h1>Hello World</h1>
// <p>This is a paragraph.</p>
// HTML to Markdown with options
const markdown = htmlToMarkdown(html, {
headingStyle: 'setext', // 'atx' or 'setext'
codeBlockStyle: 'indented', // 'fenced' or 'indented'
bulletListMarker: '-', // '-', '+', or '*'
emDelimiter: '_', // '_' or '*'
strongDelimiter: '**' // '**' or '__'
});
// Markdown to HTML with options
const html = markdownToHtml(markdown, {
html: true, // Enable HTML tags in source
linkify: true, // Auto-detect URLs and convert to links
typographer: true, // Enable smart quotes and other typographic replacements
breaks: false // Convert '\n' in paragraphs into <br>
});
Once installed, the extension provides the following commands:
Cmd+Shift+P (Mac) or Ctrl+Shift+P (Windows/Linux)Cmd+Shift+P (Mac) or Ctrl+Shift+P (Windows/Linux)The extension also provides:
Ctrl+Alt+M for HTML→MD, Ctrl+Alt+H for MD→HTML| Option | Description | Default |
|---|---|---|
-o, --output <file> | Output file path | Auto-generated (.md) |
-s, --stdout | Output to stdout | false |
--heading-style <style> | Heading style (atx/setext) | atx |
--code-block-style <style> | Code block style (fenced/indented) | fenced |
| Option | Description | Default |
|---|---|---|
-o, --output <file> | Output file path | Auto-generated (.html) |
-s, --stdout | Output to stdout | false |
--no-html | Disable HTML tags in source | false |
--no-linkify | Disable auto link detection | false |
--no-typographer | Disable typographic replacements | false |
We welcome contributions! Please see our Contributing Guidelines for details.
# Clone the repository
git clone https://github.com/jasdeepkhalsa/html-md-converter.git
cd html-md-converter
# Install dependencies
npm install
# Run tests
npm test
# Run linter
npm run lint
# Format code
npm run format
html-to-md blog-post.html -o blog-post.md
md-to-html README.md -o index.html
# Convert all HTML files in a directory
for file in *.html; do html-to-md "$file"; done
# Convert all Markdown files
for file in *.md; do md-to-html "$file"; done
# Fetch HTML from URL and convert
curl https://example.com | html-to-md /dev/stdin --stdout
# Convert and preview in browser
md-to-html README.md --stdout | open -f -a "Google Chrome"
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run with coverage
npm test -- --coverage
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by the open source community
FAQs
A bidirectional HTML to Markdown and Markdown to HTML converter with CLI and VS Code extension support
We found that html-md-converter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
The PHP Foundation says Chainguard broke a security embargo ahead of critical RCE patches, as leaks disrupted the coordinated release.

Security News
PHP releases emergency patches for two critical RCE vulnerabilities as agencies urge organizations to take unpatched sites offline.

Threat Research
/Security News
A supply chain attack compromised LiteLLM 1.107.0 on PyPI and Docker, spreading malware that steals cloud credentials, developer secrets, and AI provider keys.