Html2pug
Converts HTML to Pug :dog:
Install / Use
/learn @izolate/Html2pugREADME
html2pug 
Converts HTML to Pug templating language (formerly Jade).
Requires Node.js version 7.6 or higher.
Turns this :unamused:
<!doctype html>
<html lang="en">
<head>
<title>Hello World!</title>
</head>
<body>
<div id="content">
<h1 class="title">Hello World!</h1>
</div>
</body>
</html>
Into this :tada:
doctype html
html(lang='en')
head
title Hello World!
body
#content
h1.title Hello World!
Install
Get it on npm:
npm install -g html2pug
Usage
CLI
Accept input from a file or stdin and write to stdout:
# choose a file
html2pug < example.html
# use pipe
echo '<h1>foo</h1>' | html2pug -f
Write output to a file:
html2pug < example.html > example.pug
See html2pug --help for more information.
Programmatically
const html2pug = require('html2pug')
const html = '<header><h1 class="title">Hello World!</h1></header>'
const pug = html2pug(html, { tabs: true })
Options
Name | Type | Default | Description
--- | --- | --- | ---
tabs | Boolean | false | Use tabs instead of spaces for indentation
commas | Boolean | true | Use commas to separate node attributes
doubleQuotes | Boolean | false | Use double quotes instead of single quotes for attribute values
fragment | Boolean | false | Wraps result in enclosing <html> and <body> tags if false
Related Skills
node-connect
349.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
