I am looking to develop a plugin that inspects metadata of blocks which are flashcards.
The block object had a different structure than I expected and I wanted to better understand block properties and how to manage them correctly
Example card block
{
"properties": {
"cardLastInterval": "11.2",
"cardRepeats": 3,
"cardEaseFactor": "2.8",
"cardNextSchedule": "2024-02-09T00:34:37.551Z",
"cardLastReviewed": "2024-01-28T20:34:37.551Z",
"cardLastScore": 5
},
"parent": {
"id": 30024
},
"id": 30023,
"pathRefs": [
{
"id": 2
},
{
"id": 30000
},
{
"id": 30001
}
],
"propertiesTextValues": {
"cardLastInterval": "11.2",
"cardRepeats": "3",
"cardEaseFactor": "2.8",
"cardNextSchedule": "2024-02-09T00:34:37.551Z",
"cardLastReviewed": "2024-01-28T20:34:37.551Z",
"cardLastScore": "5"
},
"uuid": "65da8fcd-78d8-4d0b-873d-ddd4e97ad721",
"content": "What is the chain rule? #card #math\ncard-last-interval:: 11.2\ncard-repeats:: 3\ncard-ease-factor:: 2.8\ncard-next-schedule:: 2024-02-09T00:34:37.551Z\ncard-last-reviewed:: 2024-01-28T20:34:37.551Z\ncard-last-score:: 5",
"page": {
"journalDay": 20230527,
"name": "may 27th, 2023",
"originalName": "May 27th, 2023",
"id": 30000
},
"propertiesOrder": [
"cardLastInterval",
"cardRepeats",
"cardEaseFactor",
"cardNextSchedule",
"cardLastReviewed",
"cardLastScore"
],
"left": {
"id": 30035
},
"format": "markdown",
"refs": [
{
"id": 2
},
{
"id": 30001
}
]
}
Expected
User added metadata is not included in properties list
I expected card
and math
to ALSO be included in the list of properties
It seems this metadata is ONLY accessible from parsing the content
property which seems like a very brittle programming given the interchangable #
and [[ ]]
.
Properties added by logseq when a block is recognized as card are not visible in the editor
Given I see properties programmatically, and I know I can manually add properties to a block with the key:: value
syntax I expected to see content list this in the editor such as:
card-ease-factor:: 2.8
card-next-schedule:: 2024-02-09T00:34:37.551Z
card-last-interval:: 11.2
card-last-reviewed:: 2024-01-28T20:34:37.551Z
card-last-score:: 5
card-repeats:: 3,
Questions
-
Is there an official method to parse the block content to extract user metadata?
In the example block above it would return “card” and “math”, and possibly the other properties too.
I am currently using RegEx but it seems like there must be a better way the logseq.Editor api exists. -
Is there a way to view ALL properties in Editor regardless of them being added by system / hidden?
I have set :block-hidden-properties #{}
in both global config.edn
and local config.edn
expecting this to mean do NOT hide any properties thus revealing ALL the card properties; however, the internal card properties are still not visible.