Before:
After:
Regex to find:
([^\n])\n*(```[\s\S]*?```)\n*([^\n])
Flags:
gm
Regex to replace:
$1\n\n$2\n\n$3
Empty lines will only be inserted if they don’t already exist.
I added this as a custom regex rule in Linter.
Before:
Regex to find:
([^\n])\n*(```[\s\S]*?```)\n*([^\n])
Flags:
gm
Regex to replace:
$1\n\n$2\n\n$3
Empty lines will only be inserted if they don’t already exist.
I added this as a custom regex rule in Linter.
I realized that there’s a native Linter rule for this. Furthermore, I had it enabled. I’m not sure what prompted me to create this solution then. Perhaps the rule wasn’t being applied in some instances.