frontprettier
v1.0.1
Published
A simple yet powerful frontmatter prettier and validator
Maintainers
Readme
Frontprettier
A simple yet powerful frontmatter prettier and validator for Markdown files.
Frontprettier helps you keep your Markdown frontmatter clean, consistent, and valid. It's particularly useful for large knowledge bases like Obsidian vaults.
Features
- ✅ Validation: Use JSON Schema to ensure your frontmatter follows your rules.
- 🎨 Formatting: Automatically sort keys and prettify YAML.
- 🧹 Cleanup: Remove null values and trim whitespace.
- 🔍 Dry Run: Preview changes before applying them.
- 📂 Batch Processing: Use glob patterns to process multiple files at once.
- ⚙️ Configurable: Fully customizable via
.frontprettierrc.
Installation
npm install -g frontprettier
# or
pnpm add -g frontprettierQuick Start
- Create a
.frontprettierrcfile in your project root:
{
"prettify": {
"order": ["type", "status", "title", "author", "date"]
},
"schema": {
"type": "object",
"properties": {
"type": { "type": "string" },
"status": { "enum": ["draft", "published"] }
}
}
}- Run Frontprettier:
frontprettierCLI Usage
Usage: frontprettier [pattern] [options]
Arguments:
pattern Glob pattern for markdown files (default: './**/*.md')
Options:
--dry-run Show what would be changed without modifying files
--verbose, -v Show detailed output
--help, -h Show this help message
Examples:
frontprettier
frontprettier './Notes/**/*.md'
frontprettier --dry-run --verboseConfiguration
The .frontprettierrc file supports the following options:
exclude: Array of glob patterns to ignore.prettify:order: Array of keys in the order you want them to appear.
schema: A JSON Schema object to validate your frontmatter.
Documentation
For more detailed information, check our Documentation.
License
MIT © Aitor Llamas Jiménez
