Disclaimer
Is this project open source? Yes
Is this project completely free? Yes
Is this project vibe-coded beyond the author’s ability to comprehend how it works? No
You can format Markdown files with dprint or any other formatter on hotkey, with Templater:
- In Templater settings, define the user function
dprintFmtwith the following content:dprint fmt --log-level warn "<% tp.file.path() %>" - Create the Templater template
templaters/dprint_fmt.mdcalling the user function:<% tp.user.dprintFmt({}) _%> - In Templater settings, assign hotkey for
templaters/dprint_fmt.md.
It works fine on my Windows and Linux.
If you know a simpler way, please let me know.
Note:
Sometimes Obsidian seems to take few seconds to reflect modifications to the file, so you may see unexpected results when you run this immediately after a modification. If you want to avoid this, you can combine it with Linter’s on-save custom command. See: Templater Action on Save : r/ObsidianMD
References: