Yves Lefebvre16 downloadsPreserves consecutive blank lines in reading mode, matching the source 1:1.
An Obsidian plugin that preserves consecutive blank lines in reading mode, matching the source 1:1.
By default, Obsidian's Markdown renderer collapses any number of consecutive blank lines into a single paragraph break in reading mode. This plugin restores the extra blanks so that the visual spacing matches what you typed.
I am migrating my notes from Zim desktop wiki to Obsidian as it has better support for code blocks and mobile devices. However, one thing that was bugging me was that some of my notes, once transferred to Obsidian, looked "cramped". I found out that Zim preserves blank lines.
I was not able to find any simple solution for Obsidian : What I found on forums was to add "/" slash character on blank line you want to preserve, or some "Em Space" (invisible character) that made editing confusing because it is difficult to see. Or some html <br> tag.
Other people say if you don't like Markdown, then use another tool than Obsidian. I see Obsidian already has some specific Obsidian-only Markdown syntax, so why not add an option in it to preserve space in reader mode? Personal notes aren't tech documentation. I want spacing the way other tools allow it.
Hence this plugin. Hope you find it useful!
Source:
First paragraph.
Second paragraph after three blank lines.
Without the plugin, reading mode collapses this to a single paragraph break. With the plugin enabled, the three blank lines are preserved.
main.js, manifest.json, and versions.json from the latest release.<your-vault>/.obsidian/plugins/preserve-blank-lines/.Not yet submitted. Once approved, it will be installable from Settings -> Community plugins -> Browse.
Each preserved blank line is rendered as a <div class="preserve-blank-line">. Add a CSS snippet (Settings -> Appearance -> CSS snippets) to tweak height:
.preserve-blank-line {
line-height: 1.5;
}
MarkdownPostProcessorContext.getSectionInfo() returns null. Blocks in those contexts are silently passed through unchanged. See the API docs.Requires Node.js 18+ and npm.
git clone https://github.com/Ivanohe73/obsidian-preserve-blank-lines.git
cd obsidian-preserve-blank-lines
npm install
npm run dev # watch mode for development
npm run build # production bundle
The build outputs main.js in the project root.