Proposed solution: yaml enclosed in curly braces after caret symbol.
E.g. ^{id: block-id, date created: 2020-11-06, authors: [he, me], inspired by: "Obsidian://vault/myvault/an%20idea"}
{#block-id, key = value, key = value}
In some existing formats (e.g. markua), metadata is located one line before multiline block (html div tag) or immediately after an “inline block”{#span-id}
or after a # header {#heading-id}
(extended markdown).
Initial caret symbol would indicate that it applies to the same scope as current Obsidian block-id syntax, not as in other formats.
It could extend to more lines with simple YAML notation and e.g. be optionally folded by default in editor.
If the YAML can be unambiguously recognized from “key = value” format, then both formats can be accepted or maybe even mixed, or extended to allow things like inclusion of unquoted wikilinks within yaml or “{#block-id}” which is syntactic sugar for “{id = block-id}” in some existing formats. So we could have e.g.
^{#block-id
title: flexible format for block metadata
date created: 2020-11-06
authors: [ '[[he]]', me ]
inspired by: '[[an idea]]'
SRS: {last rep: 2020-10-13, mark: easy, next rep: 2021-08-06}
}
Future use cases
- conversion between block-metadata and YAML-front-matter when refactoring notes from blocks to separate files and back
- filtering blocks in search
- displaying values in columns alongside text, like e.g. in “Notion” software or in Windows-File-Explorer.
- tracking of provenance
- conversion to graph database and analysis e.g. in Neo4j with Cypher
- …
Keywords:
- attributes, database, graph, metadata, properties
Related feature requests:
- argrown - uses the same syntax for metadata except the preceding caret symbol. https://argdown.org/syntax/#statement-yaml-data
- Recording creation and revision dates in the metadata for a note
- Attributes for Embedded Sections
- Support pandoc attributes
- Simple spaced repetition plugin
- Allow internal links to any element via anchor
- metadata on file level (already implemented): Metadata standard
- outside of Obsidian:
- proposal for CommonMark: https://talk.commonmark.org/t/consistent-attribute-syntax/272