For markdown I strongly suggest using dprint CLI tool (https://dprint.dev/), and possibly write a plugin which executes it on save. It will automatically wrap lines and also enforce formatting for all your .md files, so they are consistent.
Dprint config (.dprint.jsonc
):
{
"markdown": {
"lineWidth": 79,
"textWrap": "always",
},
"excludes": [
"**/*-lock.json",
],
"plugins": [
"https://plugins.dprint.dev/markdown-0.18.0.wasm",
],
}
Install:
curl -fsSL https://dprint.dev/install.sh | sh
Execute:
dprint fmt yourfile.md
Format all your code base:
dprint fmt
You can wrap dprint
in a simple plugin to execute it on save. Not tested:
import sublime_plugin, subprocess
class RunFixersOnSave(sublime_plugin.EventListener):
def on_post_save(self, view):
subprocess.call(["dprint", "fmt", view.file_name()])
I’m not a developer, but I regularly work with thousands of Markdown files.
In this case I think you could also benefit from LSP-marksman (gives you things like go-to definition) and LSP-cspell plugins (highlights spelling errors). You can install them via Package Control.