SlRvb / Obsidian--ITS-Theme

Theme designed with readability and customizability in mind. Change it easily to your liking with the Style Settings plugin installed.
https://publish.obsidian.md/slrvb-docs/ITS+Theme/ITS+Theme
GNU General Public License v2.0
553 stars 115 forks source link

[Bug] Lists in Reading View Have Incorrect New Lines when New Line is Added Anywhere into List Markdown #289

Closed Rvby1 closed 6 months ago

Rvby1 commented 6 months ago

Describe the bug

When you create a list of items, but have a new line present anywhere in the list, the entire list is rendered as if there are new lines between every bullet point. For example...

- Item1
- Item2
- Item3
- Item4

The above renders as expected

- Item1
- Item2

- Item3
- Item4

While the above will render with a newline between Item1, Item2, Item3, and Item4

A header seems to disrupt the rendering, so if I had two lists, only the first one would render wrong...

# List 1
- Item1
- Item2

- Item3
- Item4
# List 2
- Item 5
- Item 6
- Item 7

While I would be much less apt to do this line-breaking with an ordered list, it technically happens there as well:

1. Item 1
2. Item 2
3. Item 3

4. Item 4

Expected behavior The new line should only appear between the list items that have a new line between them in the actual markdown (Item2 and Item3 in the examples above).

To Reproduce

Steps to reproduce the behavior:

  1. Paste any of the latter two examples into a new document with ITS Theme enabled

Screenshots

image image

OS

Where does the bug occur?

Versions

Additional context

I was able to recreate this bug on a fresh vault, so I don't believe it's anything related to my style settings.

SlRvb commented 6 months ago

So this is default behavior I've styled for spaced lists, but I can add an option to disable it for those that doesn't want this behavior

SlRvb commented 6 months ago

Added to ITS v1.2.52, do let me know if the toggle works. It can be found under Note > Lists > Lists / Bullet Adjustments > Remove Spaced Lists Styling

Rvby1 commented 6 months ago

Let me just say amazing work on this again. Thank you for being so receptive to changes and requests.

This toggle does work, but it goes a bit too far in the opposite direction for what I personally was wanting. I was hoping for new lines to appear where new lines actually are in the list (so between items 2 and 3), but NOT appear between items 1 and 2 and between items 3 and 4. With the new option, it just gets rid of all new lines, effectively making the new lines useless aside from some separation in the editing view.

I'm not sure if that would be a nightmare to implement or not, though! And this is again totally opinionated, so I understand if it's not something you want to add an option for.

SlRvb commented 6 months ago

Oooh I see, hmmm, that's not too possible with only css alone as the html structure of lists is either nonspaced or spaced. The best you can do is have something separating the two lists like a horizontal line so the html displays it correctly or a comment line to force the parser to read it as two separate lists like:

- horizontal line break
- spaced lists

---
- horizontal line break

- spaced lists
- comment line break
- spaced lists

%% comment break or I guess an html comment <-- --> or <br> could do the same trick%%
- comment line break

- spaced lists
Rvby1 commented 6 months ago

Ahh, that makes sense. I guess that if a new line is present in the list, it's flagged in a way that demarcates the entire list as being spaced? I wonder if there would be a way for the core system to include some sort of demarcation symbol in the list, or maybe a change to make the lists be separated (unique <ul> blocks or <ol> blocks) rather than lumping them in together when there's a new line.

I'll let you close this in the way you want. Technically a feature has been added, but the real request is impossible with the current HTML structure provided by the app. I might reach out to the core team to see if there's any interest in spending time on this niche request...

SlRvb commented 6 months ago

I'll close this, but do try and see if the team is willing! I would love to have this feature too!