All Projects → izolate → Html2pug

izolate / Html2pug

Licence: mit
Converts HTML to Pug 🐶

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Html2pug

Prance
Resolving Swagger/OpenAPI 2.0 and 3.0 Parser
Stars: ✭ 133 (+12.71%)
Mutual labels:  parser, converter
Relaxed
Create PDF documents using web technologies
Stars: ✭ 11,656 (+9777.97%)
Mutual labels:  converter, pug
Length.js
📏 JavaScript library for length units conversion.
Stars: ✭ 292 (+147.46%)
Mutual labels:  parser, converter
To Milliseconds
Convert an object of time properties to milliseconds: `{seconds: 2}` → `2000`
Stars: ✭ 136 (+15.25%)
Mutual labels:  parser, converter
Gelatin
Transform text files to XML, JSON, or YAML
Stars: ✭ 150 (+27.12%)
Mutual labels:  parser, converter
Htmr
Simple and lightweight (< 2kB) HTML string to React element conversion library
Stars: ✭ 214 (+81.36%)
Mutual labels:  parser, converter
Graphql Mst
Convert GraphQL to mobx-state-tree models
Stars: ✭ 22 (-81.36%)
Mutual labels:  parser, converter
Save For Offline
Android app for saving webpages for offline reading.
Stars: ✭ 114 (-3.39%)
Mutual labels:  parser
Ltgt
Lightweight HTML processor
Stars: ✭ 117 (-0.85%)
Mutual labels:  parser
H2c
headers 2 curl. Provided a set of HTTP request headers, output the curl command line for generating that set. Try the converter online at
Stars: ✭ 113 (-4.24%)
Mutual labels:  converter
Parze
A clean, efficient parser combinator
Stars: ✭ 113 (-4.24%)
Mutual labels:  parser
Nmonvisualizer
A Java GUI tool for analyzing NMON system files
Stars: ✭ 114 (-3.39%)
Mutual labels:  parser
Vte
Parser for virtual terminal emulators
Stars: ✭ 117 (-0.85%)
Mutual labels:  parser
Netcopa
Network Configuration Parser
Stars: ✭ 112 (-5.08%)
Mutual labels:  parser
Instagram Parser
Парсер аккаунтов подписчиков и подписок в Instagram
Stars: ✭ 118 (+0%)
Mutual labels:  parser
Py360convert
Python implementation of convertion between equirectangular, cubemap and perspective. (equirect2cube, cube2equirect, equirect2perspec)
Stars: ✭ 113 (-4.24%)
Mutual labels:  converter
Crass
A Ruby CSS parser that's fully compliant with the CSS Syntax Level 3 specification.
Stars: ✭ 118 (+0%)
Mutual labels:  parser
Pkhex
Pokémon Save File Editor
Stars: ✭ 1,781 (+1409.32%)
Mutual labels:  converter
Chirp
A modern low-level programming language
Stars: ✭ 116 (-1.69%)
Mutual labels:  parser
Startbootstrap Resume
Start Bootstrap is an open source library of free Bootstrap themes and templates. All of the free themes and templates on Start Bootstrap are released under the MIT license, which means you can use them for any purpose, even for commercial projects.
Stars: ✭ 1,642 (+1291.53%)
Mutual labels:  pug

html2pug Build Status

Converts HTML to Pug templating language (formerly Jade).
Requires Node.js version 7.6 or higher.

Turns this 😒

<!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 🎉

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
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].