Title: Bikeshed Documentation
H1: Bikeshed, Your Friendly Spec Generator
Shortname: bikeshed
Level: 1
Status: LS
URL: https://speced.github.io/bikeshed/
Editor: Tab Atkins-Bittner
Repository: speced/bikeshed
Abstract: Bikeshed is a spec-generating tool that takes in lightly-decorated Markdown and spits out a full spec, with cross-spec autolinking, automatic generation of indexes/ToC/etc, and many other features.
Markup Shorthands: css no, markdown yes
Ignored Terms: h1, h2, h3, h4, h5, h6, xmp
Installing {#installing}
========================
Using Bikeshed Without A Local Install {#install-no}
----------------------------------------------------
### Via the Web ### {#install-web}
If you use Bikeshed infrequently,
and are okay with requiring a network roundtrip every time you invoke Bikeshed,
you probably want to use [the Bikeshed API instead](https://api.csswg.org/bikeshed/).
In return, the API version is always up-to-date,
so you don't have to remember to update things yourself.
See [[#remote]] for options.
Note: The remote API has several limitations;
most notably, it can't take multiple files.
If you are using custom boilerplates,
or include files,
you'll have to run Bikeshed yourself.
### Via `pipx` ### {#install-pipx-run}
If you use Bikeshed infrequently,
but have the prereqs for a local install
(a recent Python 3, and `pipx`; see below),
you can run an always-up-to-date Bikeshed locally as:
```bash
pipx run bikeshed update && pipx run bikeshed
# on subsequent invocations, just call:
pipx run bikeshed
```
This does not have the limitations of the web version;
you can use all the features of Bikeshed,
including custom boilerplates
and include files,
or alternate run modes
like `bikeshed watch`.
Note: This actually creates a *temporary* local install,
which automatically disappears after a few days.
It does not add the `bikeshed` command to your PATH.
However, it generally won't require manual upgrading;
so long as it's been long enough for `pipx` to delete the cached version,
it'll always grab the newest version of Bikeshed.
Prereqs {#install-prereqs}
--------------------------
Bikeshed is a Python program,
and getting Python working well in modern systems
has a few (pretty easy) steps.
(These might already all work for you!)
### `python3` ### {#install-py3}
Bikeshed requires Python 3.9 or later.
(It's currently tested up to 3.11.)
To tell what version you have,
run:
```bash
python3 --version
```
If it reports 3.9 or later, you're fine.
If it's earlier, you'll need to update your local Python version.
There are several ways to do so,
but I recommend `pyenv`
as a safe and easy method.
https://github.com/pyenv/pyenv#installation gives instructions for installing pyenv on various environments.
It also links to the auto-installer, which can make things even easier.
Windows users have slightly different instructions,
but it links to a windows fork as well.
If you know your way around pyenv already,
feel free to do what you're used to here.
Otherwise, it's usually easiest to set up 3.10 as your "default" Python:
```bash
pyenv versions
```
will list what versions exist, and then
```bash
pyenv global 3.10.4
```
will set 3.10.4 as your "global" version, used by default.
(Substitute in whatever the name of the version you saw in `versions` was.)
### `pipx` ### {#install-pipx}
Installing packages globally is usually a bad (and sometimes insecure!) idea.
They should instead be isolated into "virtual environments".
This used to be a little tricky to set up,
but now `pipx` makes it very simple.
To install pipx,
your system software distribution might already have it;
for example, distributions using `apt` can run
```bash
sudo apt-get install pipx
```
If this is not the case for you,
see pipx's install instructions
and do whatever it says.
Installing Bikeshed Itself {#install-final}
-------------------------------------------
### Installing For Normal Use ### {#install-normal}
Assuming the prereqs (above) are satisfied,
installation is trivial:
```bash
pipx install bikeshed
```
When this is completed, Bikeshed should be installed,
and the `bikeshed` command should work in your shell.
Note: If this is your first time running `pipx`,
you might get a message complaining about your PATH variable,
and Bikeshed's attempt to update its data files will fail.
If so, follow `pipx`'s instructions,
then run `bikeshed update` again.
After this, invoking Bikeshed is just:
```bash
cd ~/my-spec-folder
bikeshed
```
Remember to update Bikeshed regularly by running:
```bash
pipx upgrade bikeshed
```
See [[#updating-bikeshed]] for more details.
You can also manually refresh Bikeshed's datafiles by running:
```bash
bikeshed update
```
But this will run automatically
whenever you use Bikeshed
if your data files are more than a few days old,
so it usually shouldn't be necessary.
Note: If you're on a Mac,
`bikeshed update` might fail with some errors about certificates.
This is a known issue with the version of Python 3.7 shipped with XCode,
which might be the default on your system.
To fix this, install Python 3.7 with [Brew](https://brew.sh/) instead.
### Installing Bikeshed for Development ### {#install-dev}
If you're installing Bikeshed so you can work on it,
or want to ensure you have the bleeding-edge tip-of-tree version,
the instructions are just a tiny bit more complex.
First, clone the Bikeshed repository:
```bash
git clone https://github.com/speced/bikeshed.git
```
Then navigate to that folder
(by default, it'll be a folder called "bikeshed"
in the current folder you're in)
and run:
```bash
pip3 install -e .
```
This will spam your console with a bunch of install progress.
When it successfully completes,
the `bikeshed` module should be globally available for import in Python,
and a `bikeshed` command should now work in your shell.
#### Installing With Pipenv #### {#install-pipenv}
You *probably* don't want to install all of Bikeshed's dependencies globally,
so I recommend using `pipenv` to install it into a virtual environment
(similar to what `pipx` does for non-dev installs).
Follow the same instructions as above,
but instead of running `pip3 install`,
run:
```bash
pipenv install --dev -e .
pipenv run bikeshed update
```
This will *not* install a `bikeshed` command by default;
instead, you run Bikeshed with `pipenv run bikeshed`.
If you'd like `bikeshed` to work by itself,
either start a pipenv shell with `pipenv shell`,
or add an alias to your machine like:
```bash
bikeshed=pipenv run bikeshed
```
Updating Bikeshed {#updating-bikeshed}
--------------------------------------
To update bikeshed to its latest version at any time,
just run:
```bash
pipx upgrade bikeshed && bikeshed update
```
This’ll pull the latest version of Bikeshed,
and ensure that you’re looking at the latest version of the data files,
rather than whatever stale version is currently sitting in the repo.
Note: If you did an "editable" install up above,
to update it you just run the install command again
and invoke `bikeshed update` afterwards.
Building a Bikeshed docker image {#install-docker}
--------------------------------------------------
Note: I don't actually understand Docker or know how to use it,
so this guide is based on one community member's efforts.
If something is wrong or outdated, uh, figure out how to fix it
and tell me so I can fix the docs.
- If needed, download and install [docker community engine](https://hub.docker.com/search/?type=edition&offering=community)
- Build the Bikeshed image from the project's directory:
```
docker build --tag=bikeshed:latest .
```
The above command will cache Bikeshed's datafiles in the Docker layer cache,
in order to speed up rebuilds.
If you want to be sure you get the latest datafiles,
run `bikeshed update` in the container or add the `--no-cache` flag when building the image:
```
docker build --tag=bikeshed:latest --no-cache .
```
- Optionally, deploy the Bikeshed image to a docker registry
For example, on a unix system (for Windows, consider the Windows Subsystem for Linux):
```
TAG=$(docker image inspect --format='{{.Id}}' bikeshed:latest)
DATE=$(date '+%Y.%m.%d')
```
Login to a docker registry.
```
docker login
```
Tag the image to be pushed as organization/artifact:version
```
docker tag $TAG /bikeshed:$DATE
```
Push the tagged image to the docker registry
```
docker push /bikeshed:$DATE
```
### Invoking Bikeshed using a docker image ### {#cli-docker}
Note: As stated up in [[#install-docker]],
I don't know how Docker works
and this guide is based on a community member's experience,
so use at your own risk.
Typically, this requires login to the docker registry and pulling a Bikeshed image.
For some `` and some ``:
```
docker login
docker pull /bikeshed:
```
Regardless of host environment's operating system, running Bikeshed from a docker image
requires two things:
- mapping a host directory to a path in the docker image (e.g. `/data`)
- specifying the location of Bikeshed's input and output relative to the path in the docker image (i.e., `/data`)
Example for a Unix host:
```
docker run --rm -v $(pwd):/data /bikeshed: bikeshed spec /data/ [/data/]
```
Example for a Windows host:
```
docker run --rm --volume C:\mystuff\project1\:/data /bikeshed: spec /data/Index.bs /data/out/Index.html
```
Note that the [[#cli-options]] apply to running Bikeshed from a docker image.
Since the Bikeshed docker image is read-only, it does not make sense to execute the Bikeshed `update` command from a docker image.
Invoking Bikeshed Without Installing {#remote}
============================================
While a locally-installed Bikeshed does provide additional functionality,
if all you need to do is process a spec,
there is an API server you can talk to,
maintained by Peter Linss.
Using Curl {#curl}
------------------
These instructions assume use of the `curl` command,
but you can use any equivalent "talk HTTP at a server" command you might have access to.
Simplest possible usage:
* passing the source as `-F file=@index.bs`
* forcing output even if there are errors with `-F force=1`
* piping the output to the desired filename with `> index.html`.
Additional possible arguments:
* `-F output=err` to just receive errors, if any
* `-F md-Foo=bar` to pass a `Foo: bar` metadata to the spec
(same as passing `--md-Foo=bar` locally)
* `-F die-on=[nothing, fatal, link-error, warning, everything]`,
(same as the `--die-on` local flag)
If your source file is online,
such as in a git repository,
you can pass the url directly instead:
If you are using additional files beyond your plain source file--
local boilerplate files,
[[#including|sub-document includes]],
[[#custom-dfns|custom definition files]],
etc--
this is the *only* way to make those still work
via the curl API;
Bikeshed will look for the additional files
relative to the source document's url.
(Any additional files that get included *implicitly*,
such as local boilerplates,
must be listed in the [=Local Boilerplate=]
or [=External Infotrees=] metadatas
to get picked up.
Files explicitly listed in the source file,
such as in a `
`,
will be picked up automatically.)
The separate `bikeshed issues-list` command
(for generating issues lists for a W3C Disposition of Comments)
can also be invoked via curl:
Using the Web Form {#web}
-------------------------
Alternately, you can just visit [https://api.csswg.org/bikeshed/](https://api.csswg.org/bikeshed/) directly,
and upload a file,
point to a URL,
or directly paste in your spec source.
It defaults to outputting both the HTML and the errors,
but you can switch it to one or the other only if you want.
Using CI Tools {#commit}
------------------------
### Travis CI ### {#travis-ci}
To use bikeshed on [Travis CI](https://travis-ci.org/)'s github integration, you'll need the following `.travis.yml` commands:
```yaml
language: python
python:
- "3.8"
install:
- pip install bikeshed
- bikeshed update
script:
# Invoke bikeshed here, at your own leisure. E.g.:
- bikeshed spec
```
[Raymond Toy has written a very thoro guide on the full setup you need to auto-build and -publish the generated files to GitHub via Travis, so you only need to check in the source files themselves.](https://github.com/rtoy/auto-deploy-spec)
### GitHub Actions ### {#gh-action-ci}
The W3C maintains a [spec-prod](https://w3c.github.io/spec-prod/#examples) GitHub Action
that allows automatically processing commits or PRs
as either Bikeshed or ReSpec.
To use, add a file to `.github/workflows/` folder in your GitHub project,
containing:
```yaml
name: CI
on:
workflow_dispatch: {}
pull_request: {}
push:
branches: [main]
jobs:
main:
name: Build, Validate and Deploy
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: w3c/spec-prod@v2
with:
TOOLCHAIN: bikeshed
# Modify as appropriate
GH_PAGES_BRANCH: gh-pages
# if your doc isn't in the root folder,
# or Bikeshed otherwise can't find it:
SOURCE: src/spec.bs
# output filename defaults to your input
# with .html extension instead,
# but if you want to customize it:
DESTINATION: src/index.html
```
The linked document has a number of usage examples to achieve various outcomes--
simple validation,
auto-publishing on w3.org/TR,
building multiple specs from a single repository,
and some others.
It also explains the entire process from start to finish,
if you need more help setting things up.
Invoking Bikeshed Locally {#cli}
================================
Locally-installed Bikeshed is invoked via the command-line.
There's a bunch of options,
but you'll only use a few in day-to-day use.
If you've installed Bikeshed via one of the standard local installs above,
you can typically just type `bikeshed` in the folder where your `.bs` file lives
and it'll do its thing,
automatically invoking the `spec` subcommand.
However, Bikeshed has a number of different subcommands,
and both global and subcommand-specific flags that can be invoked.
Global Options {#cli-options}
-----------------------------
There are a few options that apply to many different options,
so they're specified before the individual commands:
: `-h` or `--help`
:: Shows the help message for the current command.
Can be run without any command,
like `bikeshed -h`
to show the list of valid commands and the global flags,
or after a command,
like `bikeshed spec -h`
to show the help text for that command in particular.
: `--die-on = [ nothing | fatal | link-error | warning | everything ]`
:: Bikeshed categorizes errors into several categories,
depending on their severity:
clear mistakes are "fatal",
errors in resolving autolinks are "link-error",
and things that look a little questionable but are totally okay to generate a document with are "warning".
The `--die-on` flag controls which sorts of errors
cause Bikeshed to fail to produce output
and exit with a non-0 status
(indicating the command failed).
Possible values are "nothing", "fatal", "link-error", "warning", and "everything",
with each level including all previous levels.
Defaults to "fatal".
It can sometimes be useful to set this to "nothing"
if you just need to push thru and generate a spec
that happens to throw some unimportant errors
you don't have time to fix.
The `-f` flag is a shorthand for this.
Alternately, it can be useful to set it to a level stricter than "fatal"
if you want to ensure that,
for example,
a CI build fails when link errors creep into your document,
or if you just generally want to ensure that your document builds "cleanly",
without any warnings at all.
"everything" is equivalent to "warning",
but is guaranteed to always die on *all* error messages,
even if more levels are added in the future.
Note that this can also be controlled from within your document
(or your group's metadata)
via the [=Die On=] metadata.
: `--die-when = [ early | late ]`
:: When Bikeshed encounters a disallowed error
(per the `--die-on` value),
it can either die *immediately*
(`early`)
so you can see the error and fix it
without the rest of the document potentially being incorrect
and throwing nonsensical errors;
or it can wait until the end of processing (`late`) to die,
so you can see all the errors
without having to continually rerun the command.
Either way, Bikeshed will exit with a non-zero status,
and refuse to actually produce an output document.
If unspecified, this defaults to `late`.
(If using `late`
and processing a document with many output messages,
it might be useful to temporarily run it with `-q` or `-qq`,
so you can focus on the more important messages first.)
Note that this can also be controlled from within your document
(or your group's metadata)
via the [=Die When=] metadata.
: `-f` or `--force`
:: A shorthand for `--die-on=nothing`.
: `-q` or `--quiet`
:: The `-q` flag suppresses one level of error messages.
It can be passed multiple times to suppress additional levels,
in the order "warnings", then "link errors", then "fatal errors".
: `-s` or `--silent`
:: The `-s` flag suppresses *all* console output from Bikeshed,
regardless of source.
(It's more powerful than `-q`,
as it'll also suppresses things like the success/failure message.)
: `-d` or `--dry-run`
:: The `-d` flag prevents Bikeshed from actually writing anything to disk.
It does everything else,
just skips that final "save" operation.
: `--print= [ plain | console | markup ]`
:: Specifies how Bikeshed should output its messages.
Default is "console",
which outputs colored text using console color codes.
"plain" outputs the same text as "console",
but without any color codes
(which look like gibberish if you're not outputting to a console).
"markup" outputs the text in a light markup structure
(suitable for parsing as HTML),
for easier parsing of the output by tools.
: `--no-update`
:: By default, Bikeshed checks how old its data files are
every time it runs,
and automatically triggers an update
(as if you ran `bikeshed update`)
if they're more than a few days old.
If this is causing problems
(for example, if something has gone wrong with the update service,
or you are offline
and don't want to wait for the network to timeout),
you can prevent it from doing the check
with `--no-update`.
: `--allow-nonlocal-files`
: `--allow-execute`
:: Bikeshed has the ability to include arbitrary files into your spec,
and in a few cases the ability to execute shell commands or Python
on your behalf
(to allow for some extensions).
By default, these are restricted:
you can only include files from the spec's own folder
or subfolders,
and arbitrary code execution is disallowed.
If you trust the specs you are processing,
and need these abilities, however,
the restrictions can be relaxed
by passing these flags.
`bikeshed spec` {#cli-spec}
---------------------------
The `spec` command is the most common one you'll use.
It turns a Bikeshed source file
into an output HTML file.
The rest of this document mostly describes how to format a source file
for use with this command.
Most of the time you can just run `bikeshed spec`
and things will "just work"
as long as your source file has the `.bs` extension.
Relevant flags:
: `--gh-token=TOKEN`
:: If you're using Inline GitHub Issues heavily,
you might run into the GitHub rate limit.
You can generate an OAuth token at https://github.com/settings/tokens
and then pass it to Bikeshed via this flag
to raise your limit considerably.
: `-l` or `--line-numbers`
:: If you're having trouble locating the source of an error in your code,
run Bikeshed with this flag
and *almost* all errors will report the source line number they appear at
(or somewhere very close - it's per-element).
This code is unfortunately forced to be fairly hacky,
and has the potential to lightly corrupt your file
(inserting extra debugging info into plain text
that just happens to look like markup),
so it automatically triggers a dry-run,
as if you'd specified `--dry-run`.
When you're done debugging,
just run again without this flag to actually get some output.
After any flags,
you can optionally specify the input file path and output file path.
Both of these can usually be omitted;
if you omit the output file,
it'll just output to a file with the same name as the input file,
but with the extension changed to `.html`;
if you omit the input file,
it'll search thru the current directory
and assume you want the first file with a Bikeshed extension (`.bs`).
If you want to feed Bikeshed from stdin
or have it output to stdout,
just use `-` as the appropriate filename.
`bikeshed watch` {#cli-watch}
-----------------------------
The `watch` command is identical to the `spec` command,
except it sets up a watcher
and auto-rebuilds the spec every time it changes.
With this turned on,
you can edit with a simple save->refresh cycle,
rather than having to do save->build->refresh.
It accepts all the same arguments as `spec`.
(Tho using stdin/stdout might get a little weird.)
Use Ctrl-C to stop the watcher
(or whatever key combo kills the currently running process in your console).
`bikeshed template` {#cli-template}
-----------------------------------
The `template` command outputs a minimal "skeleton" document to stdout.
It's useful to get started with Bikeshed,
without having to remember what all the required metadata is.
On a Linux-like command line,
it should be used like:
```
bikeshed template > index.bs
```
`bikeshed echidna` {#cli-echidna}
---------------------------------
The `echidna` command hooks into the W3C's Echidna auto-publishing system,
letting you publish W3C specs from the command-line,
rather than having to go thru a staff contact.
Note: Currently, only Working Drafts (**not** including FPWD) and Candidate Recommendation Drafts can be published via Echidna.
It's invoked similarly to `bikeshed spec`,
with three required flags:
: `--u USERNAME`
:: Your W3C username
: `--p PASSWORD`
:: Your W3C password
: `--decision DECISION_URL`
:: A link to a publicly-visible message approving the publication of this draft.
There are some optional flags:
: `--editorial`
:: Marks the publication as an editorial update.
: `--cc EMAILS`
:: A comma-separated list of email addresses
which the W3C will ping
when the publication request is completed.
: `--additional-directories [DIRECTORY ...]`
:: By default, Bikeshed will look for directories named
`images`, `diagrams`, and `examples`,
and include them and their contents in the publication.
This flag will override that list,
letting you specify any number of files and/or folders
that should be included with the publication.
: `--self-contained`
:: Conversely, this flag signals
that the document doesn't use anything external,
so it shouldn't include anything
even if one of the default directories does exist.
: `--just-tar`
:: The Echidna service works
by accepting an uncompressed TAR file
of all the files that will be published.
Passing this flag just constructs that TAR file
and prints it to stdout,
without actually contacting Echidna.
After the flags,
you can optionally specify the input file path,
just like for `bikeshed spec`;
if omitted,
it selects a file automatically in the same way.
Bikeshed then builds the spec normally,
performs a little bit of fixup for common issues that PubRules complains about,
and submits the spec to Echidna.
It will print out a URL for you to check on the progress of your publication;
it should complete in a few seconds.
Most likely you'll have some PubRules errors when you check your progress;
fix those
(ask in irc.w3.org#pub for help if needed)
then just run `bikeshed echidna` again.
Note: If auto-publishing via Travis CI,
[this Travis blog post about encrypted environment variables](https://blog.travis-ci.com/2014-08-22-environment-variables)
will be helpful for safely using your W3C password.
### Testing Publication Locally ### {#echidna-testing}
Publishing via Echidna automatically does some "fixup" on your document,
to fix some common errors that would make the doc fail the W3C's PubRules check.
These fixes are controlled by the Prepare For TR metadata,
so if you want to see precisely what your spec will look like when it's published,
add that to your metadata block manually.
If you want to go further,
and see the actual TAR file that will be sent to the Echidna service,
you can pass `--just-tar` to the command
(and omit the authentication flags that are normally required).
This will cause Bikeshed to create a file named `test.tar` in your current directory.
### Echidna Hooks ### {#echidna-hooks}
Bikeshed's default publication behavior is usually sufficient,
but if you need to customize it in some way,
there are a few hooks you can use
(assuming you can write Python).
In an include file named `bs-extensions.include`,
provide an implementation of the following methods
(check the default version of this file for the default implementations,
for the methods you don't want to change):
: `BSPrepTR(doc)`
:: This method is called after processing is done,
when the document is ready to be packed up and sent to Echidna.
Here, you can perform whatever final post-processing is required.
For example, the CSSWG EDs link to a stylesheet
in the parent directory of the server they're stored on.
In their `BSPrepTR()`,
they search for the link to that stylesheet,
and update it to point to the current directory instead.
: `BSPublishAdditionalFiles(files)`
:: This method allows you to specify what files should be included in the publishing bundle.
It must return an array of additional files/folders;
each entry must either be a string,
referring to a file/folder in the spec's directory or subdirectories,
or a tuple of 2 strings,
the first of which points to a file outside the spec's directory,
and the second of which provides the path the file should have within the spec's directory.
The `files` value provides the default values,
which you probably want to just extend,
rather than fully replace.
It defaults to `["images", "diagrams", "examples"]`,
indicating that those folders,
if present,
will be included.
For example, as stated in the example for `BSPrepTR()`,
the CSSWG needs to include its stylesheet in with its specs.
To do so,
it just needs to add the entry `["../default.css", "default.css"]`
to the `files` array,
indicating that Bikeshed should grab the `default.css` file from the parent directory,
and put it in the spec's directory
(in the bundle)
with the same name.
`bikeshed update` {#cli-update}
-------------------------------
The `update` command updates Bikeshed's datafiles,
which it uses for autolinking and similar things.
By default it'll update all of its datafiles,
but if you want to update only particular ones,
you can pass any or all of the following flags:
* `--anchors` to update Bikeshed's "anchor data" - a list of all the definitions and headers it knows about.
* `--biblio` to update Bikeshed's bibliography database.
* `--caniuse` to update Bikeshed's CanIUse.com information.
* `--link-defaults` to update Bikeshed's manually-maintained list of special linking rules.
* `--test-suites` to update Bikeshed's database of test-suite information from the Shepherd system.
* `--languages` to update Bikeshed's database of language codes/names (used for the [=Translations=] metadata)
* `--wpt` to update Bikeshed's database of WPT tests; see [[#testing]].
By default, Bikeshed's update system relies on the [Bikeshed-Data](http://github.com/speced/bikeshed-data) project,
which preprocesses the various data sources directly into Bikeshed's data formats,
and prepares a manifest of changed files,
letting Bikeshed quickly download only what it needs.
However, this can be up to 10 minutes out of date
(or longer, if the update process has fallen over);
if you need absolutely up-to-date information *right now*,
pass the `--skip-manifest` flag
to force Bikeshed to do its full manual update process.
(You can combine it with any of the flags above to only get the exact files you need.)
`bikeshed refs` {#cli-refs}
---------------------------
The `refs` command lets you search Bikeshed's anchor database,
letting you see what sort of things it's looking at when doing autolinking.
This can be very useful for debugging,
or just for a quick check of where something is defined.
It's flags are similar to the attributes used on autolinks:
* `--text=FOO` to specify the linktext you want to filter for
* `--type=FOO` to specify the link type
* `--for=FOO` to specify the for value
* `--spec=FOO` to specify the spec
* `--status=foo` to specify the status
* `--exact` to turn off the variations that Bikeshed applies to some link texts
(such as looking for "book" when you search for "books"),
and just search for the exact text you specified
Any or all of these flags can be specified,
and Bikeshed will display all the refs it can find matching the criteria.
`bikeshed source` {#cli-source}
-------------------------------
The `source` command applies various transformations to the source document itself,
rather than producing a separate output document.
Its options are described in [[#source]].
`bikeshed issues-list` {#cli-issues-list}
-----------------------------------------
The `issues-list` command processes a plain-text document
in an "issues-list" format pioneered by the CSSWG
into an equivalent HTML version.
Relevant flags:
* `-t` outputs a template issues-list file to stdout,
making it easier to start a new document
without having to reference an old one to remember the format.
Use it like `bikeshed issues-list -t > issues-19700101.txt`.
After the command you can pass the input and output filenames.
As usual, one or both can be omitted:
if you omit the output,
it'll write to a file with the same name as the input,
but a `.html` extension;
it you omit the input,
it will look in the current folder
for any files starting with "issues" and ending in ".txt",
and then extract the digits from those filenames
and select the one with the largest number.
If you name your file as suggested above,
with an ISO date,
it'll correctly always choose the latest issues list.
Issue: Define the issues-list format.
The `-t` output is already more than enough to actually work with,
but it would still be good to describe it more fully.
Metadata {#metadata}
====================
Crucial to the processor's ability to automatically generate most of a spec's boilerplate is a small metadata section,
typically located at the top of a file.
A metadata block is just a <pre class='metadata'> element, with contents like:
```html
Status: UD
TR: http://www.w3.org/TR/css-variables/
ED: http://dev.w3.org/csswg/css-variables/
Shortname: css-variables
Level: 1
Editor: Tab Atkins Jr., Google, http://xanthir.com/contact
Editor: Daniel Glazman, Disruptive Innovations, daniel.glazman@disruptive-innovations.com
Abstract: This module introduces cascading variables as a new primitive value type that is accepted by all CSS properties,
and custom properties for defining them.
```
The syntax of a metadata block is very simple - it's a line-based format, with each line consisting of a key and a value, separated by a colon.
Or if you're adding multiple lines with the same key, you can just start the subsequent lines with whitespace to have it reuse the last-seen key.
Several keys are required information, and will cause the processor to flag an error if you omit them:
* Title is the spec's full title, used to generate both the <{title}> and <{h1}> of the document.
This can alternately be specified by adding an <{h1}> element as the first line of the spec.
Note: The optional [=metadata/H1=] metadata lets you specify the text you want for the document's <{h1}>,
if for some reason you want the <{title}> and <{h1}> to have different text.
For example, some browsers interpret markup as literal text in <{title}>,
so you may want to provide "plain text" in the [=metadata/Title=] metadata
and marked-up text in [=metadata/H1=].
* Status is the spec's status. There are a few general abbreviations that can be used any group (or specs without a Group at all), and several that are restricted to particular groups.
Statuses usable by anyone
* DREAM: "A Collection of Interesting Ideas"
* LS: "Living Standard"
* LS-COMMIT: "Commit Snapshot"
* LS-BRANCH: "Branch Snapshot"
* LD: "Living Document"
* FINDING: "Finding"
Statuses usable by W3C groups
* ED: "Editor's Draft"
* WD: "W3C Working Draft"
* FPWD: "W3C First Public Working Draft"
* LCWD: "W3C Last Call Working Draft"
* CR: "W3C Candidate Recommendation Snapshot"
* CRD: "W3C Candidate Recommendation Draft"
* PR: "W3C Proposed Recommendation"
* REC: "W3C Recommendation"
* PER: "W3C Proposed Edited Recommendation"
* WG-NOTE: "W3C Working Group Note"
* IG-NOTE: "W3C Interest Group Note"
* NOTE: "W3C Note" ([unclear what this is used for](https://github.com/w3c/tr-design/issues/124))
* NOTE-ED: "Editor's Draft" of a Group Note
* NOTE-WD: "W3C Working Draft" of a Group Note
* NOTE-FPWD: "W3C First Public Working Draft" of a Group Note
* MO: "W3C Member-only Draft"
* UD: "Unofficial Proposal Draft"
* CG-DRAFT: "Draft Community Group Report"
* CG-FINAL: "Final Community Group Report"
Bikeshed has a listing of what Groups are associated with the W3C.
If your Group isn't on that list,
it'll complain when you try to use a W3C status.
Please file a bug on Bikeshed to add your Group,
and/or prefix your status like `Status: w3c/ED`.
Statuses usable by ISO groups
* I: "Issue"
* DR: "Defect Report"
* D: "Draft Proposal"
* P: "Published Proposal"
* MEET: "Meeting Announcements"
* RESP: "Records of Response"
* MIN: "Minutes"
* ER: "Editor's Report"
* SD: "Standing Document"
* PWI: "Preliminary Work Item"
* NP: "New Proposal"
* NWIP: "New Work Item Proposal"
* WD: "Working Draft"
* CD: "Committee Draft"
* FCD: "Final Committee Draft"
* DIS: "Draft International Standard"
* FDIS: "Final Draft International Standard"
* PRF: "Proof of a new International Standard"
* IS: "International Standard"
* TR: "Technical Report"
* DTR: "Draft Technical Report"
* TS: "Technical Specification"
* DTS: "Draft Technical Specification"
* PAS: "Publicly Available Specification"
* TTA: "Technology Trends Assessment"
* IWA: "International Workshop Agreement"
* COR: "Technical Corrigendum"
* GUIDE: "Guidance to Technical Committees"
* NP-AMD: "New Proposal Amendment"
* AWI-AMD: "Approved new Work Item Amendment"
* WD-AMD: "Working Draft Amendment"
* CD-AMD: "Committee Draft Amendment"
* PD-AMD: "Proposed Draft Amendment"
* FPD-AMD: "Final Proposed Draft Amendment"
* D-AMD: "Draft Amendment"
* FD-AMD: "Final Draft Amendment"
* PRF-AMD: "Proof Amendment"
* AMD: "Amendment"
Bikeshed has a listing of what Groups are associated with ISO.
If your Group isn't on that list,
it'll complain when you try to use an ISO status.
Please file a bug on Bikeshed to add your Group,
and/or prefix your status like `Status: iso/ER`.
Statuses usable by the TC39 group
* STAGE0
* STAGE1
* STAGE2
* STAGE3
* STAGE4
Statuses usable by the AOM groups
* PD: "Pre-Draft"
* WGD: "Working Group Draft"
* WGA: "Working Group Approved Draft"
* FD: "Final Deliverable"
* ED (or its synonym URL) must contain a link that points to the most current draft
(typically the "editor's draft", or otherwise the version that's most live and updated).
* Shortname must contain the spec's shortname, like "css-lists" or "css-backgrounds".
* Level (or Revision, an alias) must contain the spec's level as an integer or `none` if the spec does not use levels.
* Editor must contain an editor's information.
This has a special format of comma-separated clauses
the first is required and must contain the editor's name;
all the rest are optional.
* If editing a W3C document, your W3C ID (the number at the end of the url when you navigate to https://www.w3.org/users/myprofile) can be added as a `w3cid ####` clause.
* Your affiliation (company you work for, etc), optionally followed by a link to their homepage, like `Example Company http://example.com`. If your affiliation contains a comma, HTML-escape it (`,`).
* Your email address.
* Your homepage.
All of the optional clauses can occur in any order, except that affiliation must occur before email or homepage.
Multiple Editor lines can be used to supply multiple editors.
* Abstract must contain an abstract for the spec, a 1-2 sentence description of what the spec is about.
Multiple Abstract lines can be used, representing multiple lines of content, as if you'd written those multiple lines directly into the document.
There are several additional optional keys:
* Die On and Die When
give the same control that the `--die-on` and `--die-when` command-line options do.
They take the same values--
a single keyword--
as the corresponding command-line arguments.
* H1 contains the text/markup that goes into the document's <{h1}> element.
If omitted, this defaults to the value of the [=metadata/Title=] metadata,
which is usually what you want.
* TR must contain a link that points to the latest version on /TR.
* Canonical URL defines the canonical URL (as used by search engines) for the document; it can be set to "TR" (the default value if TR is defined), "ED", or a specific URL.
* Favicon defines the favicon URL for the document; it only supports one single URL.
* Logo defines the logo url for the document; it only supports one single url.
This URL can be used via the `[LOGO]` text macro ([[#text-macros]]),
and is by default used by the `logo` boilerplate section ([[#bp-sections]]).
* Former Editor must contain a former editor's information, in the same format as Editor.
* Warning must contain either "Obsolete", "Not Ready", "New Version XXX", "Replaced by XXX", "Commit deadb33f http://example.com/url/to/deadb33f replaced by XXX", "Branch XXX http://example.com/url/to/XXX replaced by YYY", or "Custom", which triggers the appropriate warning message in the boilerplate.
If set to "Custom", the metadata keys Custom Warning Title and Custom Warning Text control what the warning contains.
* Previous Version can contain either a URL to a previously-published version (such as versions published on w3.org/TR),
or the value `from biblio` or `from biblio my-spec-1`.
Links get displayed literally in the spec's metadata section. "from biblio" entries instead auto-generate a link to the latest dated version of the given versioned shortname that appears in the biblio database. (If omitted, the spec's own versioned shortname is implicitly used.)
* At Risk must contain an at-risk feature. You can specify this key more than once for multiple entries.
* Group must contain the name of the group the spec is being generated for. This is used by the boilerplate generation to select the correct file. If omitted, it defaults to a generic set of boilerplate.
* Dark Mode must contain a [=boolish=]
for whether or not Bikeshed includes darkmode-relevant colors/etc
for all of its built-in styles.
It defaults to "on",
but if you provide custom styles that are not darkmode-aware,
you should set this "off"
so Bikeshed features don't render for darkmode
and become unreadable against your lightmode styles.
* Status Text allows adding an additional customized sentence that can be used in the document status section.
* Ignored Terms accepts a comma-separated list of terms and makes Bikeshed not emit warnings or errors when attempting to autolink those terms. Use this to quiet spurious preprocessor warnings caused by you inventing terms (for example, the Variables spec invents custom properties like 'var-foo'), or as a temporary patch when the spec you want to link to doesn't set up its definitions correctly.
* Date must contain a date in YYYY-MM-DD format, which is used instead of today's date for all the date-related stuff in the spec. Alternately it can contain the string `now`, which explicitly indicates a date of precisely when the output is generated.
* Deadline is also a YYYY-MM-DD date,
which is used for things like the LCWD
and CR Snapshot Status section,
to indicate deadlines.
* Expires is also a YYYY-MM-DD date,
or can be the string `now` to indicate today's date,
or can be an "ISO Duration" like `P1Y` to indicate "+1 year"
from the [=Date=] metadata
(or the spec's generation date if that's not specified),
and indicates when the document should be considered "expired"--
before the expiration date an (initially closed) warning about the upcoming expiration is automatically included in the document;
afterwards the warning defaults to being open and annoying.
It can also take a [=boolish=] false value or `never` to indicate it never expires;
this is just the default value,
so these values are only useful for turning off a default expiration
established by your default metadata.
* Test Suite must contain a link to the test suite (like https://test.csswg.org/suites/css-flexbox-1_dev/nightly-unstable/).
Note: This merely displays a "Test Suite" item in the spec's header-list,
as linked text.
To display WPT results,
see [[#testing]].
* Implementation Report must contain a link to an implementation report,
either a hand-written document
or just a link to the spec's folder on wpt.fyi.
This is required for W3C Candidate Recommendation Snapshot.
* Mailing List must contain an email address to be used for mailing lists.
* Mailing List Archives must contain a link to the list archives.
* Issue Tracking indicates what and where you track issues,
and will result in an "Issue Tracking" entry in your spec header.
It must contain a comma-separated list of locations,
each of which consists of the name of the location followed by the url.
Bikeshed will automatically add additional entries to this in some situations:
if you use any inline issues,
you'll automatically get an "In Spec" annotation;
if you develop from within a git repo with a GH remote,
or have the [=metadata/Repository=] metadata set,
you'll automatically get a "GitHub" annotation.
You can turn off the spec-header entry entirely with `Boilerplate: feedback-header off`,
or just turn off the GitHub entry specifically with `Boilerplate: repository-issue-tracking off`.
* Issue Tracker Template specifies a url template used to point [remote issues](#remote-issues) at your issue tracker of choice. It takes a url, with `{0}` in the place where you want the remote identifier to go.
* Translation indicates a translation of the document. At minimum it consists of a language code (BCP47 format) and a url. Optionally, it can contain comma-separated `name [name-in-spec-language]` and `native-name [name-in-translation-language]`, but if Bikeshed knows about that language, these will be filled in for you. (If Bikeshed doesn't know about a given language, let me know what its name is in English and itself!)
* Indent tells Bikeshed how many spaces you prefer to use to indent your source code,
so it can properly parse your Markdown and data-blocks.
It takes a single integer,
and defaults to `4` if unspecified.
(Of course, using tabs avoids this entirely,
as one tab is always one indent.)
* No Editor lets you omit the `Editor` metadata without an error.
It takes a boolish value.
This shouldn't generally be used;
even if your organization doesn't privilege editors in any way,
putting the organization itself in the `Editor` field
meets the intent while still producing useful information for readers of the spec.
* No Abstract lets you omit the `Abstract` metadata without an error.
It takes a boolish value.
This should only be used for very small and trivial documents, where the abstract would just be repeating the title of the more-or-less.
* Editor Term is a pair of comma-separated terms giving the singular and plural terms to refer to editors with, if you want something other than the default "Editor(s)".
* Default Ref Status takes the values "current" or "snapshot",
and selects which URL you want to default to
for bibliography and autolinks entries that have both "current" and "snapshot" URLs.
(You can also specify this per-biblio entry or per-autolink.)
* Default Biblio Display takes the values "index" (default), "inline", or "direct"
and selects whether biblio autolinks default to
displaying as their shortname and linking to the bibliography index ("index"),
displaying as their title and linking straight to the referenced document ("inline"), or
displaying as their shortname and linking to the referenced document ("direct").
(You can also specify this per-biblio entry.)
* Markup Shorthands lets you specify which categories of markup shorthands you want to use; for example, you can turn off CSS shorthands and reclaim use of single quotes in your spec. You can still link to things with explicit markup even if the shorthand is turned off. Its value is a comma-separated list of markup categories and boolish values, like `css no, biblio yes`. The currently-recognized categories are:
* `algorithm`, covering the special <{var}> shorthand (the `|foo|` shorthand)
* `biblio`, covering the dfn autolinks for biblio links and section links (the `[[foo]]` shorthands)
* `css`, covering the dfn autolinks for CSS types
* `dfn`, covering the dfn autolinks for "dfn" and "abstract-op" type definitions
* `http`, convering the [=dfn autolinks=] for "http-header" type definitions
* `idl`, covering the dfn autolinks for WebIDL types (the `{{foo}}` shorthand)
* `markdown`, covering the various inline Markdown syntaxes (block-level Markdown is always supported)
* `markup`, covering the dfn autolinks for HTML/etc elements and attributes (the `<{foo}>` shorthand)
Everything but `markdown` defaults to "on".
* Text Macro lets you specify custom text macros, like `[TITLE]` or `[DATE]`, letting you fill in different text when building a spec in multiple ways. (This is mostly useful as a command-line option.) Each Text Macro line consists of a macro name, which must be uppercase and alphanumeric, followed by the text it will get replaced with.
* Work Status indicates the status of the document, in a way unrelated to the publication status of Status. It must be one of (completed, stable, testing, refining, revising, exploring, rewriting, abandoned), with those terms defined in [Fantasai's blog](http://fantasai.inkedblade.net/weblog/2011/inside-csswg/process). This just sets the `[WORKSTATUS]` text macro to the corresponding word, used in some of the boilerplates to pipe the metadata to scraping tools.
* Repository indicates the repository the spec is being tracked in.
You can specify a url followed by a "short name" for it,
and it populates the `[REPOSITORY]` and `[REPOSITORYURL]` text macros accordingly.
If you are using GitHub,
you can just specify `username/repo`,
and Bikeshed will infer the rest for you.
If you're developing *from within a GitHub repo*,
you don't need to specify this at all,
as Bikeshed will figure it out automatically!
(That said, if you're working in a *fork*,
you should still specify the main repo's information here,
or else the spec will point to your fork instead.)
If using GitHub,
this metadata causes Bikeshed to automatically add a "GitHub" annotation
to the Issue Tracking entry in your spec header.
You can turn this off with `Boilerplate: repository-issue-tracking off`.
* Inline Github Issues tells Bikeshed whether
to fetch the text of GitHub issues and inline them into the document, or not.
It takes a boolish value,
or the values "full" or "title".
If it's true or "full",
any [remote issues](#remote-issues) of the form user/repo#issuenumber
will have their contents replaced by the contents of the corresponding issue from GitHub;
if it's "title",
they'll have their contents replaced by just the title of the remote issue
(so a large, well-written initial issue post doesn't derail a spec).
If your [=metadata/Repository=] is set up to a GitHub repo,
[remote issues](#remote-issues) with just an issue number
will also be expanded to the corresponding issue from your repository.
* Opaque Elements and Block Elements are a comma-separated list of custom element names, to help control Bikeshed's parsing and serialization. By default, custom elements are treated as inline; marking an element as "opaque" makes it like <{pre}>, so shorthands and Markdown aren't processed in it, and it's serialized precisely as entered; marking an element as "block" makes it interrupt paragraphs when it starts a line, and causes the pretty-printer to serialize it in a block-like way.
* Note Class, Issue Class, Assertion Class, and Advisement Class specify the class name given to paragraphs using the note/issue/advisement markup shorthand. They default to "note", "issue", and "advisement".
* Informative Classes is a comma-separated list of classes that should be considered "informative" or "non-normative"--
elements with these classes must not contain definitions or requirements,
and Bikeshed will verify this for you
(either automatically, or via the `Complain About: accidental-2119` metadata).
"note", "example", "informative", and "non-normative" all trigger this behavior by default.
* Translate IDs maps Bikeshed-generated IDs to manually-specified IDs, for cases where you need to manually specify an ID but it's generated by Bikeshed in a hard-to-override way (like IDL blocks). It takes a comma separated list of Bikeshed IDs and new IDs.
* Default Highlight specifies the default highlighting language. Every <{pre}>, <{xmp}>, and <{code}> will automatically be highlighted according to the specified language, unless they or an ancestor specifies a different `highlight=foo` or `nohighlight` attribute overriding it.
* Line Numbers is a boolish specifying whether, by default, code blocks (<{pre}> and <{xmp}>) should get line numbers. Defaults to off.
* Toggle Diffs is a boolish that specifies whether Bikeshed should include a 'Hide deleted text' button to toggle hiding <{del}> elements in your spec header. Defaults to off.
* Boilerplate toggles the generation of individual [boilerplate sections](#bp-sections). Its value is a comma-separated list of section name and boolish value, e.g. `Boilerplate: issues-index no` to disable the list of issues.
* Local Boilerplate tells Bikeshed which boilerplate include files to look for relative to the specification (as opposed to inside the Bikeshed source). Its value is a comma-separated list of include file basename and boolish value, e.g. `Local Boilerplate: footer yes` to look for `footer.include` and `footer-[STATUS].include` next to the specification. This also works for default includes that aren't quite boilerplate like [defaults.include](#default-metadata), [computed-metadata.include](#computed-metadata), and [bs-extensions.include](#echidna-hooks).
* External Infotrees lists which of [anchors.bsdata](#custom-dfns) and [link-defaults.infotree](#link-defaults) should be found in files adjacent to the specification instead of in `
` blocks inside it.
* Complain About indicates what nits you'd like Bikeshed to complain about, that are normally too noisy to be turned on by default. Its value is a boolish list like Markup Shorthands. Accepted values are:
: `accidental-2119`
:: Complains about usage of RFC 2119 terms (may, must, should, etc) in non-normative sections.
If you *need* to use one of those terms
(such as in an example about using them),
you can put a `class=allow-2119` on the text's immediate parent element.
: `broken-links`
:: Checks all the external links in the document,
and verifies that they result in a 200 response code.
Might take a while if your document links out a lot!
: `missing-example-ids`
:: Complains about examples without a manually-specified ID.
(Examples auto-generate an ID based on their contents otherwise,
which might not be stable over time.)
: `mixed-indents`
:: Checks that all of your line-starting whitespace is either tabs *or* spaces, not both. (Complains both about a line using spaces when your document otherwise uses spaces, and a line using a mix of tabs and spaces at once.)
This intentionally skips lines in "raw" elements
like <{pre}>,
because mixing tabs and spaces is completely reasonable there:
using tabs to match the indent of the opening tag,
then spaces to align the preformatted text.
This value *is turned on by default*. You can turn it off with `Complain About: mixed-indents no`
* Infer CSS Dfns is a boolish that specifies whether Bikeshed should try to "infer" what type a <{dfn}> is by looking at the text,
using CSS-biased heuristics.
(In other words, this'll only auto-detect certain CSS types.)
Defaults to off.
* Assume Explicit For is a boolish that specifies whether an omitted `for` attribute on an autolink should imply `for="/"`
(that is, selecting a definition without a `for` value),
or just not express a `for` requirement at all
(that is, selecting a definition without caring about what its `for` value is).
Truthy values set the former,
falsey set the latter.
Defaults to off.
Note: Turning this on is a better match for some people's mental models,
but it requires you to specify more `for` values on your autolinks
even when it's not necessary to disambiguate things,
so it's off by default.
* Max ToC Depth specifies the maximum depth you want the ToC to generate to. It can be the value "none", meaning generate the ToC normally, or an integer between 1 and 5. It defaults to "none".
* Several keys related to the \[MDN](https://developer.mozilla.org/en-US/docs/Web) project:
* Include MDN Panels is a soft boolish that specifies whether to include \[MDN](https://developer.mozilla.org/en-US/docs/Web) panels or not.
If it's turned on, MDN panels will be added automatically in output,
positioned to line up with the elements which define the features the panels annotate.
Each MDN panel includes a hyperlink to the MDN article for the feature it annotates,
as well as browser-support details for the feature
(similar to what's shown in the panels added when [=Include Can I Use Panels=] is enabled).
Because this examines MDN links for the IDs to use,
no configuration is necessary beyond turning the feature on;
the panels will automatically be added to the definitions or headings
with the associated IDs.
If your spec is not *yet* in MDN,
but you'd like the panels to be added when it shows up,
you can pass one of the "maybe" values of a [=soft boolish=]
to allow it to silently upgrade when possible;
otherwise, if directly turned on,
it will emit a fatal error if it can't find your spec.
* Ignore MDN Failure takes one of the IDs that MDN is attempting to target,
and prevents Bikeshed from emitting a warning
if it can't find that ID.
You can supply this multiple times
to ignore several IDs,
if needed.
This allows you to have avoid having a build warning
while waiting for MDN to be updated.
* Several keys relate to the [Can I Use](https://caniuse.com/) project:
* Include Can I Use Panels is a boolish that specifies whether to include [Can I Use](https://caniuse.com/) usage-data panels or not. If it's turned on, elements can take a `caniuse="featureID"` attribute, where the `featureID` is the value specified in the url like `https://caniuse.com/#feat=FEATUREIDHERE`, and the panel will be positioned to line up with that element.
(When possible, put this on the corresponding <{dfn}>,
as the panel doesn't have any special indication of what feature it's for;
if you don't, you must ensure the element has an ID of its own.)
* Can I Use URL automatically informs you when/if Can I Use starts tracking new features from your spec, so you don't have to check that yourself.
It takes a single URL prefix, and can be specified multiple times to provide multiple URLs.
These URLs are checked against the Can I Use data,
and if there are any Can I Use features whose URL includes one of the specified URLs as a prefix,
and the feature isn't already specified somewhere in your spec,
it will log a warning for you.
* Ignore Can I Use URL Failure takes one of the URLs specified in [=Can I Use URL=],
and suppresses the warning that Bikeshed emits if the URL doesn't show up in the Can I Use database.
(This error exists to help catch typos,
rather than just letting it silently fail.)
This allows you to put your URL in pre-emptively,
and get an error only when Can I Use *does* include your specification
(and you thus have features that aren't being tracked in your spec).
* Custom Warning Title specifies the title of a "custom" warning,
requested via `Warning: custom` metadata.
* Custom Warning Text specifies the body of a "custom" warning.
Like Abstract,
it accepts multiple lines,
and is parsed as Markdown
(as if you'd written them directly into the document).
* Prepare For TR is a boolish that specifies
whether or not to apply a bunch of automatic "fixups"
for common errors that would make a spec fail the W3C's PubRules check.
This is applied automatically when you run the [[#cli-echidna|Echidna]] command to publish your spec,
but you can use it manually to check precisely what your spec will look like when published.
* Use Dfn Panels is a boolish that determines
whether "definition panels" are generated for every definition;
it defaults to true.
These "panels" show up when you click on a <{dfn}>,
and show every local reference to the definition.
It automatically adds some JS and CSS to your page for the panels;
you can suppress this with `Boilerplate: script-dfn-panel no, style-dfn-panel no`
and supply your own if desired.
* Metadata Include and Metadata Order are defined in [[#rearranging-metadata]].
* Remove Multiple Links is a boolish (defaulting to false)
that controls whether Bikeshed automatically suppresses multiple autolinks to the same term
in a single paragraph.
(That is, if multiple autolinks point to the same URL within a single parent element,
all but the first will be reverted to plain <{span}>s.)
* Slim Build Artifact is a boolish (defaulting to false)
that specifies whether or not Bikeshed should try and "slim" the output,
to make it more appropriate as an obvious "build artifact",
rather than an active usable spec.
This turns off various usability features which otherwise bloat your HTML,
and which aren't necessary if the output isn't intended to be actively used by humans.
The exact set of features that are affected by this will evolve over time.
* Required IDs is a list of IDs that the document *must* contain.
This can be used to ensure that certain links into the document don't rot over time.
* Force Crossorigin is a [=boolish=] that auto-adds the `crossorigin=anonymous` attribute
to every relevant element (<{link}>, <{script}>, <{img}>, <{audio}>, <{video}>).
You can set a different `crossorigin` value manually on the element,
or skip the element entirely by putting `nocrossorigin` on it or an ancestor.
* WPT Path Prefix is a partial URL path
that specifies a common path prefix for all of the tests in your <{wpt}> elements.
* WPT Display takes the values "none", "closed", "open", or "inline",
and specifies whether and how <{wpt}> elements display anything in the output document.
* Tracking Vector Class is the HTML `class` attribute value used on the link inserted in elements annotated with the `tracking-vector` attribute.
* Tracking Vector Image is an image URL that can be used to represent tracking vectors with an external image.
Otherwise an inline SVG is used. The image is a child of the aforementioned link.
* Tracking Vector Image Width is the width of the external image, if any.
* Tracking Vector Image Height is the height of the external image, if any.
* Tracking Vector Alt Text is the replacement text for the inline SVG or external image.
* Tracking Vector Title is the title for the inline SVG or external image.
* Image Auto Size is a [=boolish=] (defaulting to true)
that specifies whether Bikeshed should [[#img-size|automatically detect the size]] of images used in the document.
A boolish value is a string representing a boolean value (true or false).
The string "yes", "on", "true", and "y" all represent true values,
while the strings "no", "off", "false", and "n" all represent false values.
A soft boolish value is either a [=boolish=] value,
or one of the strings "maybe", "if possible", or "if needed",
indicating an intermediate intention between something being turned on and off.
You can also provide custom keys with whatever values you want,
by prefixing the key with `!`,
like `!Issue Tracking: in spec`.
Any custom keys are collected together and formatted as entries in the "spec metadata" boilerplate <{dl}>.
Specifying a custom key multiple times will put all the values as <{dd}>s under a single <{dt}> for the key.
A custom key name equal to one of the auto-generated keys
will add your custom value as an additional <{dd}> under that auto-generated key.
Some of the metadata keys are *deprecated*;
you shouldn't use them,
but just in case you run into them in the wild,
they're documented here for understanding.
Each one recommends what you should be using instead.
* Use <i> Autolinks turns on legacy support for using <{i}> elements as "dfn" autolinks.
It takes a boolish value.
Instead of using this,
just use the <{a}> element to autolink, as usual.
* Link Defaults lets you specify a default spec for particular autolinks to link to.
The value is a comma-separated list of entries,
where each entry is a versioned spec shortname,
followed by a parenthesized link type,
followed by a "/"-separated list of link phrases.
For example, `Link Defaults: html (dfn) allowed to show a popup/in parallel`.
Instead of using this,
use a `
` block,
as the error message suggests when this is necessary.
* Ignored Vars accepts a comma-separated list of variable names,
and makes Bikeshed not emit warnings or errors about them being used only once in the document/algorithm.
Instead of using this,
put an `ignore` attribute on the <{var}> in question.
Default Metadata {#default-metadata}
------------------------------------
To specify default metadata for all specs generated for a given group and/or spec status,
add an appropriate `defaults.include` file to the `bikeshed/boilerplate/` folder.
This file must be a JSON file,
with the keys and values all strings matching the above descriptions.
Here's an example file:
```js
{
"Mailing List": "www-style@w3.org",
"Mailing List Archives": "http://lists.w3.org/Archives/Public/www-style/"
}
```
Computing Metadata From Other Metadata {#computed-metadata}
-----------------------------------------------------------
If your Group produces several specs,
and they all share some formulaic metadata that could be auto-generated with a bit of string-replacement,
you can achieve this automatically with a "computed-metadata.include" file in the `bikeshed/boilerplate/` folder.
It has the exact same syntax as the `defaults.include` file,
except that you can use [[#text-macros|text macros]] in the file,
based on all the previous metadata
(defaults, `
`, and command-line overrides).
Note: Don't forget about custom text macros with the [=Text Macro=] metadata,
if none of the pre-defined ones give you the substitution strings you need.
Note: By necessity from the definition,
these metadata override all previous metadata.
Make sure that everything you set in this file
is *really* something that every single spec in your Group should have.
Note: Bikeshed assumes that any text macros you use will be used *inside of* JSON strings,
and escapes them accordingly.
(In other words, you don't have to worry about JSON-escaping when writing your macros,
but you do need to ensure that all macros occur inside of double-quotes in your computed-metadata.include file.)
Overriding Metadata From The Command Line {#overriding-metadata}
----------------------------------------------------------------
If you want to generate multiple versions of a spec from the same source
(such as a primary spec, plus some snapshots),
you can override the metadata from the command line to generate the alternate forms.
For any metadata key defined above,
just pass it as a `--md-foo=bar` command-line argument.
For example, to override the **Status** metadata,
run `bikeshed spec --md-status=ED`.
(If the metadata name has spaces in it, use dashes to separate the words instead.)
### Known Issues ### {#md-issues}
1. You can't override the `Use Autolinks` status, because you can't input the `<>` characters.
I don't intend to fix this, as you shouldn't be specifying this in the first place.
2. You can't supply custom metadata keys (ones with a `!` prefix).
If you want to do this, let me know, and I'll work on it.
3. Passing values with spaces in them is tricky.
This is [an issue with the argparse library](http://bugs.python.org/issue22909).
The only way around it is to specify both of the positional arguments (the input and output filenames),
then put the offending argument after them.
Ordering Between Metadata Sources {#metadata-order}
---------------------------------------------------
When you specify a particular metadata key multiple times in your document,
the exact behavior depends on which metadata key it is,
but all of the behaviors depend on the order things appear in.
For example, if you specify [=metadata/Title=] twice,
the second one is used.
This also happens when metadata keys are duplicated between multiple sources,
like from your `defaults.include` file and your `
` block.
It's important, then,
to know what order the different sources are resolved in,
so you know which key "wins",
or in what order a list of things is constructed in.
The ordering is, from first to last:
1. "baseline" metadata (the default values that Bikeshed uses)
2. `defaults.include` metadata
3. `computed-metadata.include` metadata
4. `
` blocks in your document
5. command-line metadata
In general, this follows the ordering of least-specific to most-specific.
HTML "Metadata" (lang="", <meta>, etc) {#metadata-html}
-----------------------
Generally, any HTML metadata
(attributes on ``,
`` or `` elements)
should be handled in your `header.include` [[#boilerplate|boilerplate file]].
However, sometimes you do need to add additional metadata
to a specific document.
For attributes that belong on ``,
such as `dir=""` or `lang=""`,
simply add an `` element with those attributes
into your source file.
A quirk of the HTML parser is that multiple `` elements,
wherever they appear,
coalesce their attributes onto the one "true" `` element
that wraps the entire document,
rather than actually showing up in the DOM.
Bikeshed's serializer will then output the one true `` element
with all the coalesced attributes.
Similarly, if you need to add ``, ``, or `
[TITLE]
[LONGSTATUS],
[DATE]
```
This uses several of Bikeshed's boilerplating features:
* Text replacement, via the `[FOO]` macros.
These macros are prepopulated by Bikeshed,
either from metadata in the spec (like `[TITLE]`) or from environment data (like `[DATE]`).
The full list of text macros can be found at [[#text-macros]].
* Boilerplate pieces, via empty container elements with `data-fill-with` attributes.
The list of Bikeshed-provided `data-fill-with` values can be found at [[#bp-sections]].
At minimum, you want to include the `abstract`, `table-of-contents`, and `spec-metadata` sections here;
they're all most useful at the top of the document.
Railroad Diagrams {#railroad}
=================
A **railroad diagram** is a particular way of visually representing a structure roughly equivalent to regular expressions, or simple grammars. They tend to be more readable and easier to grok than their equivalents written in terse regexps, and smaller than their equivalents written in explicit parsers.
Here's an example of a railroad diagram, this one describing the syntax of valid IDENT tokens in CSS:
Bikeshed supports the automatic generation of railroad diagrams from a simplified DSL. To use, simply embed a diagram description in a `
` element - it'll get replaced by an appropriate <{svg}> element.
The Diagram Language {#railroad-lang}
--------------------
Diagrams are described by a custom DSL that somewhat resembles Python.
A railroad diagram consists of a number of nested elements, each of which may contain multiple children. Each element is specified as a command followed by a colon, possibly followed by additional data (the prelude), and the element's children indented on following lines, like:
```
T: /*
ZeroOrMore:
N: anything but * followed by /
T: */
```
This draws the following diagram:
T: /*
ZeroOrMore:
N: anything but * followed by /
T: */
The top-level elements are assumed to be a sequence of elements in the diagram.
Inside of a diagram, any of the elements may be used.
Elements are split into two groups: containers and text.
The containers hold other elements, and modify their semantics:
* Sequence (And, Seq) - used for sequences of elements which must all be selected in order. Like concatenation in regexes. Takes 1 or more children.
* Stack - A sequence that arranges its children vertically. Useful for preventing diagrams from becoming excessively wide. Takes 1 or more children.
* Choice (Or) - used for a choice between elements. Like the `|` character in regexes. Takes 1 or more children. Optionally, the "default" index may be provided in the prelude (defaulting to 0).
* Optional (Opt)- used for an element that's optional. Like the `?` character in regexes. Takes 1 child. Optionally, the word `skip` may be provided in the prelude to indicate that this term is skipped by default.
* OneOrMore (Plus)- used for an element that can be chosen one or more times. Like the `+` character in regexes.
Takes 1 or 2 children: the first child is the element being repeated, and the optional second child is an element repeated between repetitions.
* ZeroOrMore (Star) - same as OneOrMore, but allows the element to be chosen zero times as well (skipped entirely). Like the `*` character in regexes.
Like [=railroad/Optional=], the keyword `skip` may be provided in the prelude to indicate that the "default option" is to skip it (repeat 0 times).
The text elements only contain text, not other elements. Their values are given in their preludes.
* Terminal (T) - represents a "terminal" in the grammar, something that can't be expanded any more. Generally represents literal text.
* NonTerminal (N) - represents a "non-terminal" in the grammar, something that can be expanded further.
* Comment (C) - represents a comment in the railroad diagram, to aid in reading or provide additional information. This is often used as the repetition value of a OneOrMore or ZeroOrMore to provide information about the repetitions, like how many are allowed.
* Skip (S) - represents nothing, an empty option. This is rarely necessary to use explicitly, as containers like [=railroad/Optional=] use it automatically, but it's occasionally useful when writing out a Choice element where one option is to do nothing.
Source-File Processing: `bikeshed source` {#source}
======================
Sometimes it's the *source* file you want to preprocess,
if there is some feature you want literally in your source
that is hard or annoying to type in yourself.
Bikeshed has some options for doing this as well.
All of these commands are accessed from the `source` sub-command,
like `bikeshed source`.
You can run individual commands by specifying their relevant flag
(see `bikeshed source -h` for a list),
or run all of them by not passing any flags.
Big Text {#big-text}
--------
When editing a large spec,
it's easy to get lost in its length,
and have to spend some time scrolling back and forth to find particular sections.
The Sublime Text editor has a special feature,
the minimap,
which shows an extremely-zoomed out version of your document while you scroll,
so you can recognize where you are in the file by the shape of your code.
This can be made even easier by putting extra-large "ASCII art" text in your source
to label major sections,
so they show up visibly in the minimap as section markers.
Bikeshed can auto-generate this "ASCII art" text for you
with its `--big-text` command.
Just add an HTML comment to your document on its own line that looks like:
<!-- Big Text: Your Text -->
If you run `bikeshed source --big-text`,
Bikeshed will replace it with a comment that looks like:
Which is clearly visible from Sublime's minimap!
You can also edit the first line to change the text,
re-run `bikeshed source --big-text`,
and it'll swap out the text art with your new text.
Appendix A: Bikeshed’s "InfoTree" Format {#infotree}
====================================================
Bikeshed's custom text formats attempt to be fairly regular;
most of them involve specifying key/value pairs,
and are line-based.
For example, Bikeshed's metadata format is one key/value pair per line,
with a colon between the key and the value.
The InfoTree format,
used by several things in Bikeshed,
is similar.
It's used when you need to specify data consisting of multiple key/value pairs,
where it's common that multiple entries share some of that data.
The InfoTree format makes this easy to read, write, and maintain.
Specifying Information on a Single Line {#infotree-one-line}
---------------------------------------
The simplest way to provide a piece of information is by putting all the key/value pairs on a single line.
In the InfoTree format, this is done by putting a colon between the key and value,
and separating the pairs with semicolons.
For example, here is an example of two "anchor" entries:
```
urlPrefix: https://encoding.spec.whatwg.org/; type: dfn; text: ascii whitespace
urlPrefix: https://encoding.spec.whatwg.org/; type: dfn; text: utf-8
```
This specifies two entries, each with three keys: urlPrefix, type, and text.
Nesting Information to Share Pieces {#infotree-nesting}
-----------------------------------
When multiple pieces of information share some key/value pairs,
you can use nesting to indicate this,
so you don't have to repeat yourself.
Here's the same two entries as before,
but using nesting to share their common information:
```
urlPrefix: https://encoding.spec.whatwg.org/; type: dfn
text: ascii whitespace
text: utf-8
```
Just like the previous, this defines two entries, each with three key/value pairs.
Now it's clearer, though, that the two entries share their `urlPrefix` and `type` data,
and you only have to maintain the common data in one place.
Comments {#infotree-comments}
-----------------------------
A line that starts with a `#` character
(with any amount of preceding whitespace)
is a comment;
it will be completely ignored for the purpose of parsing.
Additional Details {#infotree-details}
------------------
The order that keys are specified in is irrelevant.
Feel free to rearrange them for readability or more effective nesting.
You can specify the same key multiple times;
the values will be collected into an array for later processing.
(Each user of InfoTree will define whether multiple values for a key is valid or not, and what it means.)
The order that the values appear in *is* preserved,
as it might be important.
(For example, in the anchor format, multiple urlPrefix values are concatenated together, to help specify urls in multipage specs.)
Additional semicolons are silently ignored;
in other words, empty entries get dropped, so you can put a final semicolon at the end of the line or not, as you prefer.