Skip to content

Bear is a beautiful (if not the most beautiful) markdown app out there. Its set of features is quite limited and that’s what allows the team to deliver such a polished app.

But markdown can get messy. Multiple empty lines, heading hierarchy, smart quotes, and other consistency things that would not bother a normal person but oh boy, do they bother me.

Online there are plenty of markdown linters, but none of them works with Bear’s notes database.

Since Bear CLI and Claude Code are now a thing, I decided to solve this for myself.

bear-lint allows you to fix the markdown in a single or multiple notes in Bear from the terminal using the newly released Bear CLI.1

You can lint a single note by typing bear-lint <note-id>

screenshot of bear-lint linting a single note

… or lint all of your notes using bear-lint --all.

screenshot of bear-lint linting all notes

You can also lint all notes under the same hashtag using bear-lint --all "#tag".

Add -n/--dry-run if you want to see the diff first without touching the note.

When run, the script does not change the modified date of your files, so notes will still appear in the same order.

Add -o if you want a summary note in Bear, tagged #bear-lint, listing everything that changed.

screenshot of bear summary note

Since this thing writes straight to your notes, I’ve run it against my own library multiple times before releasing it. I’ve also added a proper test suite, including a check that running it twice in a row doesn’t undo or redo its own work. If it still gets something wrong, let me know.

Check it out on Github!

Footnotes

  1. For this reason you’ll need Bear 2.8 or above

GitHub - i-am-fran/bear-lint: A dependency-free CLI linter and fixer for Bear notes — cleans up Markdown style issues by reading and writing notes directly via bearcli
GitHub
GitHub - i-am-fran/bear-lint: A dependency-free CLI linter and fixer for Bear notes — cleans up Markdown style issues by reading and writing notes directly via bearcli
A dependency-free CLI linter and fixer for Bear notes — cleans up Markdown style issues by reading and writing notes directly via bearcli - i-am-fran/bear-lint