Skip to content

Signifier color does not show in live preview #3

Description

@davidstosik

Hi there!

Love the idea of being able to use BuJo-style lists on Obsidian, so far the plugin has been very useful.

I noticed a minor inconvenience with it however, where the signifiers are not coloured in live preview mode.

To reproduce:

  • create a new sandbox vault
  • install the "BuJo Bullets" community plugin (v 1.2.1)
  • open a new note, start typing:
- ! signifier on a list item
- [ ] ? signifier on a checkbox
Image

What I expected: the two signifiers ! and ? should appear red (it's the --text-error color for the default theme).
What I see: the signifiers stay black.

If however I toggle the reading view, I can see the signifiers turn red.

Image

(Toggling back to live view, the signifiers are black again.)

It would be nice if signifiers were more prominent in live view mode (especially since I'd guess most users will often use a BuJo-like page in live view: pretty, but easily editable).

I noticed a couple things that looked weird to me and that I thought I'd mention too:

  1. In reading view, the <span class="bujo-bullet-signifier"> wrapper is wrapped twice around the signifier:
<span class="bujo-bullet-signifier"><span class="bujo-bullet-signifier">?</span></span>
  1. I think this piece of code generates duplicates:
    const renderedNotes = element.findAll('ul > li')
    const renderedCheckboxes = element.findAll('.task-list-item')
    const renderedBullets = [...renderedNotes, ...renderedCheckboxes]

    The task-list-item class is applied on <li> tags. As a result, the items in renderedCheckboxes were also included in renderedNotes, making renderedBullets contain all checkbox items twice. (This is probably what causes the double wrapping I mentioned above.) A more correct way would be, I think, to write the following:
      // const renderedNotes = // not needed anymore
      const renderedCheckboxes = element.findAll('.task-list-item')
      const renderedBullets = element.findAll('ul > li')

You might also want to rely on the has-list-bullet class placed on the ul tag (eg. using the CSS selector 'ul.has-list-bullet > li'), though I'm not 100% sure about how that class is used by Obsidian.

I don't think these two things are related to the live preview thing, but it's worth mentioning since they're in a the same code area.

Would be nice if we could get a pretty live view of signifiers!

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions