Introduction
Code is easier to read when everyone lays it out the same way, and nobody should spend a review on spaces. kscript fmt tidies scripts (.kscript and .ks.xml files) and the .html pages that kscript serve runs. The editor uses the same formatter for Format Document and format on save, so the command line and every editor agree.
To get started, format the project you're in:
| Command | What it does |
|---|---|
kscript fmt | Format every script and page in the current project. |
You may also name files and folders, or check without changing anything, which suits CI:
| Command | What it does |
|---|---|
kscript fmt scripts/ index.html | Format these files and folders. |
kscript fmt --check | Change nothing; list unformatted files and exit 1 if there are any. |
A folder covers the same files as kscript check: scripts everywhere, and .html pages in folders that look like a site (_layout.html, _components/, _layouts/ or kscript.json). Inside a project, format.include and format.exclude in kscript.json decide instead. Markdown pages are never reformatted, because their whitespace is part of the Markdown.