Format Dataview metadata in the preview editing view using a css snippet
I’d like to be able to format my dataview metadata tags so that something like
[foo::bar.com]
appears with the key bolded without me having to add formatting to the actual key. If I type the following I get the appearance I would like:
[*foo*::bar.com]
Things I have tried
Generally I add the formatting directly to the Key or Value but I feel that’s just bad data management. I’ve been searching for another example of someone modifying the default formatting but haven’t found antyhing yet
holroy
August 28, 2024, 9:47am
2
Here are three posts related to various formatting of Dataview inline fields:
Oh, I forgot to mention one way of defining the summary. If you define it inline like the following example note:
[summary:: This is my summary, which is too long to fit on one line, so really someone should summarise the summary to make it shorter]
And some more descriptive text...
This could be styled into something like:
[image]
using CSS like the following:
.inline-field-key[data-dv-key="summary"] {
display: none;
}
.inline-field-key[data-dv-key="summary"] + .inline-field-value {
…
Here is a little out of the box solution using inline fields from Dataview which should be possible to make compatible with the anki plugin by extending the regex a little.
With this markup:
[Q:: What two modern notions about architecture do we need to leave behind to understand Egyptian architechture?]
[A:: The need for change and innovation, and the need for an appropriate relation between material and form.]
[Q:: Which is the first letter of the alphabet?]
[A:: A]
- [Q:: Can inline fiel…
I’m a little late to the show, but have you considered using inline fields from dataview?
With the following markup:
[chip:: 16:21] Learned something new today...
And this CSS in a snippet:
:not(.cm-active) .inline-field-key[data-dv-key="chip"] {
display: none;
& + .inline-field-value {
background-color: var(--color-blue);
border-radius: 8px;
}
}
You get an output like:
[image]
This can of course be style however you like.
1 Like
Thank you so much!! These really help. I think I was searching using sub par vocabulary
system
Closed
September 25, 2024, 6:22pm
4
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.