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

0.3.3: table item converts to ordered list, ruining vertical spacing #199

Open
Moonbase59 opened this issue May 9, 2021 · 2 comments
Open

0.3.3: table item converts to ordered list, ruining vertical spacing #199

Moonbase59 opened this issue May 9, 2021 · 2 comments

Comments

@Moonbase59
Copy link

@Moonbase59 Moonbase59 commented May 9, 2021

I was just testing my new Upcoming Birthdays script and setting the date format to D. MMMM when suddenly the table vertical spacing went berserk:

obsidian-dataview-bug-cell-becomes-ordered-list

After inspecting using the dev console, I found that all "Birthday" items were parsed into ordered lists (maybe because something like 17. May looks like one).

I assume more people run into this (displaying data that "looks like" and gets somehow parsed), so what can be done?

@blacksmithgu
Copy link
Owner

@blacksmithgu blacksmithgu commented May 14, 2021

Ah, interesting. Dataview defers to the Obsidian markdown parser for rendering fields to let people put markdown in fields which gets rendered properly (particularly useful for links, bolds, italics, and so on). As you say, in this case it detects <number>. <something> as a ordered list and adds a bunch of spacing since they have large padding in CSS.

I can make a dv.literal() function which forces a field to be rendered exactly as-is without markdown as one option.

@Moonbase59
Copy link
Author

@Moonbase59 Moonbase59 commented May 15, 2021

Hmm. Guess this would make some people happy (especially those who see single bullets, odd lists and this "ordered list interpretation").

BUT somehow I’m rather hesitant at inventing a new "language" and permanently throwing new bits & pieces to it. Eventually, this makes learning hard, logic unclear, and code awfully difficult to maintain. And of course somebody would come and wish for "not like a list item, but I want to use bold & highlight markdown codes please". Or something.

Not always easy to decide which way to go, I guess.

Assuming we had dv.literal(), for above example, would I then just change

p.birthday ? nextBirthday(p.birthday).format(dateformat) : '–',

to

dv.literal(p.birthday ? nextBirthday(p.birthday).format(dateformat) : '–'),

?

(I have to check for null/empty and replace by ndash, because otherwise I get a single unordered list bullet, with all its spacing problems.)

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

Successfully merging a pull request may close this issue.

None yet
2 participants