datacore icon indicating copy to clipboard operation
datacore copied to clipboard

[bug] dc.Table returns poor HTML when frontmatter value is empty

Open Apina opened this issue 3 months ago • 2 comments

When pulling in frontmatter data, if the value is empty it produces a td > span > ul > li > ::marker

Correct result would be td > span (empty) or td (empty)

Adding literally anything other than a space to the key:value pairs value will make the table behave properly.

This marker basically messes up the styling by adding in a bullet point with large padding on the ul (datacore styling).

Tested on a new vault with only Datacore enabled and the issue persists.

Image

Code used is just a modified example

datacorejsx  
// A list of columns to show in the table.  
const COLUMNS = [  
{ id: "Name", value: page => page.$link },  
{ id: "Description", value: page => page.value('description') },  
];  
  
return function View() {  
// Selecting `#game` pages, for example.  
const pages = dc.useQuery('@page and path("NPCs") and location.contains("Palebank")');  
  
// Uses the built in table component for showing objects in a table!  
return <dc.Table columns={COLUMNS} rows={pages} />;  
}  
Frontmatter on "problem" note
---
type: npc
description:
publishable: true
tags: []
world: Oerth
location: Palebank
created_date: <% tp.date.now("YYYY-MM-DD") %>
---

Edit: not sure if this is odd behaviour or not but also noticed that if you use single punctuation such as dash, plus sign, equals, etc. it either removes the item completely, has the same issue as above, or just leaves a blank value.

Apina avatar Sep 22 '25 14:09 Apina

By default, Datacore displays empty values as -, which gets rendered as a list item in markdown (probably unintended, but I'm not sure). You can go to the settings and simply erase the "Empty Values" setting, or write down \- to actually display a dash.

Gudine avatar Sep 22 '25 15:09 Gudine

By default, Datacore displays empty values as -, which gets rendered as a list item in markdown (probably unintended, but I'm not sure). You can go to the settings and simply erase the "Empty Values" setting, or write down \- to actually display a dash.

Thank you. I emptied that setting and that seems to be a workaround for having an empty value. Having - does seem to use a dash (after reloading).

I feel the setting needs to be escaped by default? Some characters (symbols specifically) work fine via the setting, others cause this issue (e.g. underscore and period were ok)

Apina avatar Sep 22 '25 16:09 Apina