Skip to content
This repository has been archived by the owner on Nov 11, 2022. It is now read-only.

chrisgrieser/obsidian-sembr

Repository files navigation

Semantic Line Breaker

Obsidian Plugin to apply and remove Semantic Line Breaks.

Table of Contents

What are Semantic Line Breaks?

At its core, Semantic Line Breaks (SemBr) simply means abiding by one rule:

When writing text with a compatible markup language, add a line break after each substantial unit of thought.
sembr.org

When you have the Strict Line Breaks settings enabled in Obsidian, single line breaks are ignored, meaning that in Reading View, the text is displayed normally.

Using semantic line breaks has three advantages:

  1. Paragraphs are broken up into units of thought. This can be helpful for writing and editing text. Think Atomic Notes but on the level of thoughts.
  2. Most tools in Obsidian work on a per-line-basis, for example Swap Line Up. While useful for outlines, those commands are basically useless when writing prose, since your lines are often entire paragraphs consisting of multiple sentences. With semantic line breaks, every line roughly equals a sentence, so that all those line-based commands now work on a per-sentence-basis. (This includes most vim commands.)
  3. Diff Views, for example using the Version History Diff Plugin, become much more useful, since they now indicate changes in sentences instead of whole paragraphs. See here for a brief example.

You can read more on Semantic Line Breaks here.

What Does this Plugin Do?

Right now, it simply adds one command, Toggle Semantic Line Breaks, which turns your prose into "semantic-line-broken" text. When the note already has semantic line breaks, the command will turn the text back into "normal-line-broken" text.

demo semantic line breaks

Additions to the official SemBr-Specification

  • YAML Headers, Dataview inline attributes (key:: value), and tables are ignored.
  • The Markdown Two-Space Rule is respected.
  • Markdown footnote keys at the end of a sentence are factored in and preserved.
  • There is a minimum of 15 characters before a semantic line break is applied, to avoid commas within enumerations getting line-breaked.

Current Limitations

  • Indented Code blocks (as opposed to fenced code blocks) are currently not respected by this plugin.
  • Prose text with pipe characters (|) is ignored, since it's interpreted as table as a precaution.
  • Even with the minimum of 15 characters, the plugin will have a few false positives when it comes to enumerations.

Installation

Right now, the plugin is still in beta. It can be installed with the BRAT Plugin.

When published, it will be available in Obsidian's Community Plugin Browser via: SettingsCommunity PluginsBrowse → Search for "Semantic Line Breaker"

Contribute

Please use the .eslintrc configuration located in the repository and run eslint before doing a pull request, and please do not use prettier. 🙂

# Run eslint fixing most common mistakes
eslint --fix *.ts

About the Developer

In my day job, I am a sociologist studying the social mechanisms underlying the digital economy. For my PhD project, I investigate the governance of the app economy and how software ecosystems manage the tension between innovation and compatibility. If you are interested in this subject, feel free to get in touch!

Profiles

Donate

Buy Me a Coffee at ko-fi.com

If you feel very generous, you may also buy me something from my Amazon wish list. But please donate something to developers who still go to college, before you consider buying me an item from my wish list! 😊

Amazon wish list