Druk ships no formatters of its own. Instead, it delegates to whatever external tools you have installed, running them automatically after a file is saved. Any command that rewrites a file in place — Prettier, gofmt, rustfmt, Black, or a custom script — can be wired up through theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/letstri/druk/llms.txt
Use this file to discover all available pages before exploring further.
formatters setting.
Enabling format on save
SetformatOnSave: true in your config to activate formatting. Without it, the formatters map is stored but never invoked.
~/.config/druk/config.json
Configuring formatters
Theformatters setting is a map keyed by comma-separated file extensions (without dots) or the special wildcard "*". Each value is a command array. Druk appends the saved file’s path as the last argument before running the command.
~/.config/druk/config.json
Wildcard *
The "*" key matches any file extension that no more-specific entry covers. It acts as a catch-all fallback — a file with a .ts extension uses the "ts,tsx,js,jsx" entry, not "*". A file whose extension has no specific entry uses "*" if it is present.
Disabling an entry
Set the command array to[] to disable a formatter entry without removing the key:
trimOnSave
trimOnSave is a separate setting from formatOnSave. When true, Druk strips trailing whitespace from every line and ensures the file ends with exactly one newline — before the formatter runs. It defaults to false.
Per-project formatter config
Put aformatters key in <project>/.druk/settings.json to override the user-level formatter map for that project. Because formatters is an object-valued setting, it replaces your user-level map entirely for that project — it is not merged entry by entry.
<project>/.druk/settings.json
autopep8 instead of whatever Python formatter is in your user config. The user-level entries for ts, go, and any other extensions are not inherited — if you need them in the project, include them explicitly.