360 Secure SkillHub
360 安全技能中心

Markdown to HTML

这是一款零依赖Python工具,核心功能是将Markdown转为自包含的响应式HTML,支持全量Markdown元素,提供明暗两种内置主题,CSS内嵌无外部依赖。典型场景涵盖通讯稿、文档、报告、邮件模板等。支持文件、stdin管道输入,可通过命令行指定输出路径、标题及主题,输出适配桌面与移动端。

claudiodrusus
claudiodrusus
热度 96.85
最近更新 2026-05-17 12:30:21
分类:效率依赖:代码执行 / 读写文件应用场景:文件转换

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add markdown-to-html
Metadata
name
markdown-to-html
description
Convert Markdown text to beautifully styled, self-contained HTML with embedded CSS. Perfect for newsletters, documentation, reports, and email templates.
triggers
["convert markdown to html","markdown to html","render markdown","style markdown"]

Markdown to HTML Converter

A zero-dependency Python tool that converts Markdown files into beautiful, self-contained HTML documents with embedded CSS styling. No external libraries needed — uses only Python's standard library.

Features

  • Full Markdown support: Headings, bold, italic, strikethrough, links, images, code blocks with syntax hints, blockquotes, ordered and unordered lists, horizontal rules, and tables
  • Two built-in themes: Light (GitHub-inspired) and Dark mode with carefully chosen colors
  • Self-contained output: All CSS is embedded inline — the resulting HTML file works anywhere with no external dependencies
  • Responsive design: Output looks great on desktop and mobile screens
  • Stdin support: Pipe content directly for use in shell pipelines

Usage Examples

Convert a file with the default light theme:

python main.py README.md -o readme.html

Use the dark theme for a presentation:

python main.py notes.md -o notes.html --theme dark --title "Meeting Notes"

Pipe from another command:

cat CHANGELOG.md | python main.py - -o changelog.html

Use in a newsletter pipeline:

python main.py issue-42.md --title "Lobster Diary #42" -o issue.html

Supported Markdown Elements

Element Syntax Supported
Headings # H1 through ###### H6 ✅
Bold **text** ✅
Italic *text* ✅
Strikethrough ~~text~~ ✅
Links [text](url) ✅
Images ![alt](url) ✅
Code blocks Triple backtick with language ✅
Inline code Single backtick ✅
Blockquotes > text ✅
Unordered lists - item or * item ✅
Ordered lists 1. item ✅
Horizontal rules --- ✅

Command Line Options

  • input — Markdown file path, or - for stdin
  • -o, --output — Output HTML file (defaults to stdout)
  • --theme — light (default) or dark
  • --title — HTML document title (default: "Document")