Skip to content

Instantly share code, notes, and snippets.

@giladbarnea
Last active May 13, 2024 13:26
Show Gist options
  • Save giladbarnea/29bed761e13363c286c58959c521c329 to your computer and use it in GitHub Desktop.
Save giladbarnea/29bed761e13363c286c58959c521c329 to your computer and use it in GitHub Desktop.
Obsidian CSS snippet for subtly indenting line wraps.
/*
An Obsidian CSS snippet to indent wrapped lines by half a character width.
Applies to Editing View (whether Live Preview or Source).
Known issues:
- Skips lines with aliased links, because they count as children.
- Does not apply to Reading View, because lines separated by a single line break become </br>-separated free text under a single <p>, thus the indentation is erroneously applied to all the lines in the block.
*/
:root {
--wrap-indent: 0.5ch;
}
body
> div.app-container
> div.horizontal-main-container
div.view-content
div.cm-contentContainer
> div.cm-content.cm-lineWrapping
> div.cm-line:not(:empty):not(:has(*)) /* Select non-empty elements that do not have children. */
{
text-indent: calc(-1 * var(--wrap-indent));
margin-left: var(--wrap-indent) !important;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment