Skip to content

Commit

Permalink
Merge pull request #20 from izolate/develop
Browse files Browse the repository at this point in the history
closes #6 #14 #15
  • Loading branch information
izolate authored Aug 12, 2017
2 parents 13c5d87 + 8790cd5 commit dbfdd43
Show file tree
Hide file tree
Showing 9 changed files with 2,637 additions and 120 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ node_modules
.DS_Store

# Test
test.*
index.html
index.pug

# Vim
*.swp
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [2.0.0] - 2017-08-12
### Changed
- CLI invocation syntax

### Added
- Support for tab indentation
- Tests

## [1.0.0] - 2017-07-09
### Changed
- Use parse5 instead of jsdom
Expand Down
59 changes: 56 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,69 @@
# html2pug
Converts HTML to Pug (formerly Jade)
Converts **HTML** to **Pug** templating language (_formerly Jade_).
Requires Node.js version `7.6` or higher.

Turns this :unamused:
```html
<!doctype html>
<html lang="en">
<head>
<title>Hello World!</title>
</head>
<body>
<div id="content">
<h1 class="title">Hello World!</h1>
</header>
</body>
</html>
```

Into this :tada:
```pug
!doctype html
html(lang='en')
head
title Hello World!
body
#content
h1.title Hello World!
```

## Install

Get it on npm:
Get it on [npm](https://www.npmjs.com/package/html2pug):

```bash
npm i -g html2pug
```

## Usage

### CLI
Accept input from a file and write to stdout:

```bash
html2pug < example.html
```

Or write to a file:
```bash
html2pug -f /path/to/file.html
html2pug < example.html > example.pug
```

See `html2pug --help` for more information.

### Programmatically

```js
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
fragment | Boolean | `false` | Wrap in enclosing `<html>` and `<body>` tags
Loading

0 comments on commit dbfdd43

Please sign in to comment.