Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
ideacco avatar

Baoyu Markdown To Html

  • 17 installs
  • 12 repo stars
  • Updated March 4, 2026
  • ideacco/baoyu-skills-openclaw

Turn markdown drafts into themed, image-aware HTML documents ready to publish or ship in static sites and newsletters.

About

baoyu-markdown-to-html is an agent skill that compiles markdown into standalone HTML using a typed style system, theme CSS, and an image pipeline that downloads remote assets and rewrites placeholders. Solo builders use it when a draft already lives in markdown—changelog, landing copy, tutorial, or newsletter—and they need a polished HTML file without hand-tuning templates in a CMS. The flow covers renderer initialization, code-theme CSS, structural HTML modifications such as removing duplicate headings, and optional backups keyed by timestamps so iterations stay reversible. It complements URL-to-markdown when your pipeline is capture → edit → publish. Complexity sits at intermediate because theme paths, image hosting, and meta fields must be coherent for acceptable output on first run.

  • Full markdown render pipeline with post-processing and HTML document builder
  • Theme CSS loading with defaults and normalized inline styles
  • Remote image download with local path substitution and content image tracking
  • Timestamped backups and parsed metadata (title, author, summary)
  • Configurable style objects aligned with HtmlDocumentMeta types

Baoyu Markdown To Html by the numbers

  • 17 all-time installs (skills.sh)
  • Ranked #1,038 of 1,879 Documentation skills by installs in the Skillselion catalog
  • Security screen: HIGH risk (skills.sh audit)
  • Data as of Aug 2, 2026 (Skillselion catalog sync)
npx skills add https://github.com/ideacco/baoyu-skills-openclaw --skill baoyu-markdown-to-html

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs17
repo stars12
Security audit2 / 3 scanners passed
Last updatedMarch 4, 2026
Repositoryideacco/baoyu-skills-openclaw

What it does

Turn markdown drafts into themed, image-aware HTML documents ready to publish or ship in static sites and newsletters.

Files

SKILL.mdMarkdownGitHub ↗

import fs from 'node:fs'; import path from 'node:path'; import { createHash } from 'node:crypto'; import https from 'node:https'; import http from 'node:http'; import process from 'node:process'; import type { StyleConfig, HtmlDocumentMeta } from './md/types.js'; import { DEFAULT_STYLE, THEME_STYLE_DEFAULTS } from './md/constants.js'; import { loadThemeCss, normalizeThemeCss } from './md/themes.js'; import { initRenderer, renderMarkdown, postProcessHtml } from './md/renderer.js'; import { buildCss, loadCodeThemeCss, buildHtmlDocument, inlineCss, normalizeInlineCss, modifyHtmlStructure, removeFirstHeading, } from './md/html-builder.js';

interface ImageInfo { placeholder: string; localPath: string; originalPath: string; }

interface ParsedResult { title: string; author: string; summary: string; htmlPath: string; backupPath?: string; contentImages: ImageInfo[]; }

function formatTimestamp(date = new Date()): string { const pad = (v: number) => String(v).padStart(2, '0'); return ${date.getFullYear()}${pad(date.getMonth() + 1)}${pad(date.getDate())}${pad(date.getHours())}${pad(date.getMinutes())}${pad(date.getSeconds())}; }

function downloadFile(url: string, destPath: string): Promise<void> { return new Promise((resolve, reject) => { const protocol = url.startsWith('https') ? https : http; const file = fs.createWriteStream(destPath);

const request = protocol.get(url, { headers: { 'User-Agent': 'Mozilla/5.0' } }, (response) => { if (response.statusCode === 301 || response.statusCode === 302) { const redirectUrl = response.headers.location; if (redirectUrl) { file.close(); fs.unlinkSync(destPath); downloadFile(redirectUrl, destPath).then(resolve).catch(reject); return; } }

if (response.statusCode !== 200) { file.close(); fs.unlinkSync(destPath); reject(new Error(Failed to download: ${response.statusCode})); return; }

response.pipe(file); file.on('finish', () => { file.close(); resolve(); }); });

request.on('error', (err) => { file.close(); fs.unlink(destPath, () => {}); reject(err); });

request.setTimeout(30000, () => { request.destroy(); reject(new Error('Download timeout')); }); }); }

function getImageExtension(urlOrPath: string): string { const match = urlOrPath.match(/\.(jpg|jpeg|png|gif|webp)(\?|$)/i); return match ? match[1]!.toLowerCase() : 'png'; }

async function resolveImagePath(imagePath: string, baseDir: string, tempDir: string): Promise<string> { if (imagePath.startsWith('http://') || imagePath.startsWith('https://')) { const hash = createHash('md5').update(imagePath).digest('hex').slice(0, 8); const ext = getImageExtension(imagePath); const localPath = path.join(tempDir, remote_${hash}.${ext});

if (!fs.existsSync(localPath)) { console.error([markdown-to-html] Downloading: ${imagePath}); await downloadFile(imagePath, localPath); } return localPath; }

if (path.isAbsolute(imagePath)) { return imagePath; }

return path.resolve(baseDir, imagePath); }

function parseFrontmatter(content: string): { frontmatter: Record<string, string>; body: string } { const match = content.match(/^---\r?\n([\s\S]?)\r?\n---\r?\n([\s\S])$/); if (!match) return { frontmatter: {}, body: content };

const frontmatter: Record<string, string> = {}; const lines = match[1]!.split('\n'); for (const line of lines) { const colonIdx = line.indexOf(':'); if (colonIdx > 0) { const key = line.slice(0, colonIdx).trim(); let value = line.slice(colonIdx + 1).trim(); if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) { value = value.slice(1, -1); } frontmatter[key] = value; } }

return { frontmatter, body: match[2]! }; }

export async f

Related skills

FAQ

Is Baoyu Markdown To Html safe to install?

skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Documentationcontentseo

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.