Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support improved styles with spaced indentation #202

Merged
merged 1 commit into from
Oct 4, 2021

Conversation

miluoshi
Copy link
Contributor

@miluoshi miluoshi commented Oct 3, 2021

Current styling of indentation lines relies on .cm-tab element which is present only when "Use tabs" setting is on.

To support styling of indentation without tabs as well, instead of adding ::before pseudo-element with border line on .cm-tab, a ::before pseudo element is added to it's parent .cm-hmd-list-indent that is present also with spaced indentation.
Instead of using border, the lines are rendered as background-image with function linear-gradient that renders repeating pattern of vertical lines. Space between lines is defined using ch unit that is defined as "a width of the glyph 0 in the element's font so it scales nicely with current font-size setting.

After testing with ~7 different themes, the new styles work with the same set of themes as original solution. It breaks mostly if a theme defines its' custom font-family.

@vslinko vslinko merged commit bd98783 into vslinko:main Oct 4, 2021
@vslinko
Copy link
Owner

vslinko commented Oct 4, 2021

Hi @miluoshi!

Wow, that's awesome! Thank you for your contribution!

Released in https://github.com/vslinko/obsidian-outliner/releases/tag/1.4.0

@miluoshi
Copy link
Contributor Author

miluoshi commented Oct 8, 2021

There might be additional indent lines added for multi-line list items:

/* Indent guide next to additional lines of a list item */
.outliner-plugin-bls .CodeMirror-line .cm-tab {
  position: relative;
}
.outliner-plugin-bls .CodeMirror-line .cm-tab::before {
  content: '';
  display: block;
  position: absolute;
  width: 100%;
  height: 100%;
  left: 3px;
  top: 0;
  border-left: 1px solid var(--text-faint);
  padding-top: 0.3em;
}

Before:
image

After:
image

@GitMurf
Copy link

GitMurf commented Oct 13, 2021

@miluoshi any way to extend the multi line list item indent line (like you have pictures above) when using 4 spaces instead of tabs? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants