Data Attributes for Query Blocks

Use case or problem

I use query blocks to create “index” lists of notes that satisfy certain search conditions. Since I’m not interested in the note context or controls for these lists, I use cssclass in the frontmatter to display the query block as only a list of note links.

This isn’t really a problem, but it is less than ideal since it applies to every query block in the note. If I wanted to have a regular query block in the same note, I would have to use fragile CSS tricks.

Proposed solution

Query blocks should be able to specify a value for a metadata attribute, similar to callouts’ data-callout-metadata. It could use a vertical bar, like callouts:

```query|some-info
tag:#something
```

This would add a metadata attribute (such as data-query-metadata) that can be used from CSS just like data-callout-metadata:

.internal-query:is([data-query-metadata="some-info"]) {
  /* css changes */
}

Related feature requests

This change would be compatible with the below request, since the title could come before the metadata.