First contribution here. A little CSS snippet so you can have some notes with full-width just by adding a CSS class into the yaml frontmatter. (It just affects the preview.)
Can you share what theme you are using and what you want to do? e.g, full width on all notes, 800px wide on all notes, full width only on certain notes, etc.
Thank you for taking interest in my reply.
I’m using AnuPpuccin. I wanted to have a css class than when given to a file it makes it full width. It should be full width in edit mode and read mode. Otherwise files should look like before.
I figured it out but it only works in edit mode, and I can’t figure out how to make it work also in reading mode. This applies to all themes, even the Minimal theme @ariehen mentions.
I don’t know the CSS you are using, but --file-line-width (or --line-width for Minimal) takes care of all three viewing modes, (Source, Live Preview, and Reading), without a lot of fuss.
If you wanted a snippet that works for most themes, including Minimal, something like this should do. (The !important is in there to take care of a theme or two that sets a custom file-line-width on the body.)
/* set a custom readable line length for all notes */
body {
--custom-line-width: 75rem; /* <- change this */
--file-line-width: var(--custom-line-width) !important;
}
body.minimal-theme.minimal-theme {
--line-width: var(--custom-line-width);
}
or on a per-note basis with a cssclass of wide-view (for example):
/* set a custom readable line length for notes with a cssclass of <wide-view> */
.wide-view {
--custom-line-width: 75rem; /* <- change this */
--file-line-width: var(--custom-line-width);
}
body.minimal-theme.minimal-theme .wide-view {
--line-width: var(--custom-line-width);
}
Tested with the default, Minimal, Shimmering Focus, Prism, Everforest Enchanted, etc., themes.
NOTE:Settings > Editor → Readable line length needs to be enabled for these to work.
I was trying to make my own implementation using max-width, but couldn’t manage to get rid of an annoying scrollbar that hugged the text. The use of custom-line-width is far better and it is even working across all themes. Thanks!
So I’m using the wide-view cssclass to good effect for an ultra-wide window use case. However, I’m finding it still doesn’t get as wide as when I turn off the “readable line length” option in Settings. How do I get that last little bit of width that disabling that option delivers?
For example, below are two screenshots of the same demo window. The wide-view cssclass is active in both cases. The second also has “readable line length” disabled. What I want is the additional content width of that second screenshot but only for the wide-view cssclass. There must be more at play here than just --file-line-width!
should be identical to having Readable Line Length disabled.
I immediately saw the difference using Minimal, so I’m assuming you are using it (if it’s not Minimal, let us know what theme it is). Using a 100% in the original snippet, it seems Minimal has a big margin for the inline-title, metadata-container, each line, etc.
So you could add that max-width to the original snippet to override Minimal and see how it goes. It’s working for me with Minimal, and as it’s isolated to only the notes with a wide-view cssclass, I don’t see any immediate issues in any other areas.