clean #
Over time, your source directory can accumulate orphaned files — markdown pages removed from SUMMARY.md, old images, unused code samples, etc. The clean command identifies all files in the source directory that are not referenced and lets you delete them.
$> romero clean
romero will parse the SUMMARY.md file and scan all referenced markdown pages for includes and images. Any file in the source directory that is not referenced by any of these is considered orphaned and listed for review:
$> romero clean
The following 3 file(s) are not referenced by SUMMARY.md or any include/image directive:
src/images/unused.png
src/old-page.md
src/orphan-dir/stale.txt
Delete these files? [y/N]
After confirming, romero will delete the orphaned files and remove any directories left empty as a result.
The following references are tracked:
- Pages listed in
SUMMARY.md - Preprocessor includes (
{{#include}},{{#rustdoc_include}},{{#openapi}}, and any custom[preprocessor.*]from yourbook.toml) - Markdown images (
) - Output configuration paths (
favicon,logo,additional-css,additional-js,input-404)
Note
External URLs (starting with http:// or https://) are ignored — only local file references are tracked.
100%