https://github.com/freddez/html-indent
https://github.com/freddez/html-indent
command-line formatting html html-indent indentation indenter rust tool vim
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/freddez/html-indent
- Owner: freddez
- License: other
- Created: 2017-02-25T18:31:59.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-13T09:03:50.000Z (over 9 years ago)
- Last Synced: 2025-08-03T04:33:27.740Z (11 months ago)
- Topics: command-line, formatting, html, html-indent, indentation, indenter, rust, tool, vim
- Language: Rust
- Size: 36.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
html-indent
-----------
`html-indent` is a html file indenter and checker.
It can be used for a single file, an entire tree, or from stdin (for editor
plugin integration).
It supports multi-line tags, and preserves relative indentation in scripts and
comments sections. Except spaces, the document structure is preserved and the
only validation check is for balanced tags.
### Command line options
```
Usage: html-indent [FILE] [options]
Options:
-h, --help print this help menu
-r, --recursive process all files in directory tree
-e, --extension ext file extension for recursive processing
-n, --dry-run dry run, don't write files
--numeric output indentation value
-c, --check check malformed tags
-l, --lines [start]-[end]
limit output to selected lines
-p, --print print html result to stdout
```
### Installation
`html-indent` is written in [Rust](http://rust-lang.org/). For the moment the
only option is to build it from source, so [install Rust](https://rustup.rs/)
then type
```
$ cargo install
```
### Editor integration
There is a [Vim](http://www.vim.org/) plugin under `tools`
directory. Just drop it in `~/.vim/indent/` and don't forget to have
```
filetype plugin indent on
```
in your `.vimrc`.
### Known alternatives
* [HTML Tidy](http://www.html-tidy.org/) : Tidy is designed to clean-up html
complete documents and I didn't succeed to indent html fragments with the
command line version.
* [GNU Emacs](https://www.gnu.org/software/emacs/) ~~editor~~
~~universe~~ environment. The included **html-mode**
and [web-mode](http://web-mode.org/), like many **Emacs**'s major
modes have implemented **indent-region** function.
* [Atom](https://atom.io/) editor. Unfortunately, the indentation doesn't work
with newlines inside tags.
### TODO
- [ ] Better error handling
- [ ] PHP integration
- [ ] Sublime text plugin