#whatwg #w3c #command-line-tool #bikeshed #web-standard #web-specification

app specfmt

Command line tool to format Bikeshed and Wattsi specifications using WHATWG conventions

5 releases

0.2.3 Jan 23, 2023
0.2.2 Jan 22, 2023
0.2.1 Nov 19, 2022
0.2.0 Nov 12, 2022
0.1.0 Nov 4, 2022

#11 in #whatwg

MIT license

24KB
411 lines

specfmt

Like rustfmt and clang-format, but for web specs

It is expected that this tool be used when developing web specifications, such as the Bikeshed specs that WHATWG works on, or even the HTML Standard (which uses a different build system, but that doesn't matter for the purposes of this tool).

specfmt contains adapted and sometimes fixed algorithms from the original rewrapper, ported to Rust.

Install

With Cargo installed, run:

$ cargo install specfmt

To install Cargo (the Rust package manager) follow these instructions.

Usage

You can format a web specification file by running:

$ specfmt [file]

Note that file is optional if you're inside the spec directory: specfmt will try and find the unique *.bs file in the current directory, or source (for whatwg/html).

By default, specfmt will:

  • Wrap lines to 100 cols
  • Prevent you from formatting a spec with uncommitted changes
  • Scope its reformatting to changes in the current spec branch

To override any of this behavior, run specfmt --help to see additional command line flags that you can pass in.

Dependencies

~3.5–5MB
~87K SLoC