Last active
May 13, 2024 13:26
-
-
Save giladbarnea/29bed761e13363c286c58959c521c329 to your computer and use it in GitHub Desktop.
Obsidian CSS snippet for subtly indenting line wraps.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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