Skip to content

Instantly share code, notes, and snippets.

@vii33
Last active November 16, 2024 00:46
Show Gist options
  • Save vii33/f2c3a85b64023cefa9df6420730c7531 to your computer and use it in GitHub Desktop.
Save vii33/f2c3a85b64023cefa9df6420730c7531 to your computer and use it in GitHub Desktop.
Changes the readable line length in Obsidian Notes. Tested in Obsidian v1.0.0

Changes the line length in Obsidian Notes. Tested with Obsidian v1.0.0

See also: https://forum.obsidian.md/t/adjustable-readable-line-length/7564/6

Note: For this to work the "readable line length" property in settings has to be enabled in settings (as expected).

700px is the default width, just adjust the number below.

Pixels px (or percentage %) are possible units that enable a width independent from the number of characters (good when adjusting the zoom level or font size). For fixed amount of characters use rem, e.g. 70rem

/* Changes the readable line length in Obsidian Notes. Tested in Obsidian v1.0.0
See https://gist.github.com/vii33/f2c3a85b64023cefa9df6420730c7531/f4ea845b240e94c9fcd47d456340f78208dab38f
*/
body {
--file-line-width: 750px;
}
@wazeerc
Copy link

wazeerc commented Aug 14, 2024

In case helpful to anyone... I've been using variations of the above snippet for some time. After Obsidian 1.0, I had a hard time getting a custom width to consistently work. Played around and came up with the following simple solution to replace all of the above. -- limited testing

/* Custom Line Width */
body {
	--line-width: 60rem !important;
	--tab-stacked-pane-width: 850px; /* Optional pane width increase */
}
/* Custom Line Width - fixes custom html elements except dataview plugin which this negatively impacts */
.markdown-source-view.mod-cm6.is-readable-line-width .cm-embed-block > div:not(.block-language-dataview) {
	max-width: 100%;
}

Thanks! This worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment