Skip to content

Commit c603570

Browse files
committed
docs(queries): add usage on multi-line queries
Reflects some of the changes on the refactoring done, as well as simply demonstrating an example of a multi-line query.
1 parent 587fced commit c603570

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

docs/usage.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,31 @@ If the above line is present in one of your notes, this plugin will detect it, a
1616

1717
```
1818
<!-- QueryToSerialize: LIST FROM #quotes WHERE public_note = true SORT file.name ASC -->
19-
<!-- SerializedQuery: LIST FROM #quotes WHERE public_note = true SORT file.name ASC -->
19+
<!-- SerializedQuery: -->
2020
- [[20 years from now, the only people who will remember that you worked late are your kids]]
2121
- [[A beautiful book is a victory won in all the battlefields of human thought.md|A beautiful book is a victory won in all the battlefields of human thought]]
2222
- [[A busy mind accelerates the perceived passage of time. Buy more time by cultivating peace of mind]]
2323
...
2424
<!-- SerializedQuery: END -->
2525
```
2626

27-
As you can see above, the result of the query gets added as Markdown below the query. Notice that the serialized version is surrounded by `<!-- SerializedQuery: <query> -->` and `<!-- SerializedQuery END -->`. Those allow the plugin to know what to replace. They should not be removed.
27+
As you can see above, the result of the query gets added as Markdown below the query. Notice that the serialized version is surrounded by `<!-- SerializedQuery: -->` and `<!-- SerializedQuery END -->` to delimit the serialized query.
2828

2929
Whenever you update that note, the query will be executed and serialized, replacing the previous serialized version.
3030

31-
WARNING: For now, the queries can only be put on a single line. Take a look at [this issue](https://github.com/dsebastien/obsidian-dataview-serializer/issues/12) for details/updates.
31+
Multiple line queries are now supported, here is an example:
32+
```
33+
<!-- QueryToSerialize:
34+
TABLE
35+
dateformat(release-date, "yyyy-MM-dd") AS "Release Date",
36+
dateformat(started-date, "yyyy-MM-dd") AS "Started Date",
37+
dateformat(finished-date, "yyyy-MM-dd") AS "Finished Date",
38+
rating-out-of-ten + choice(recommended, " ❤️", "") AS "Note"
39+
FROM "Y. Content/Games" OR "03 - Resources/Games"
40+
WHERE file.name != "🏠 Games"
41+
SORT finished-date DESC
42+
-->
43+
```
3244

3345
Note that a single note can include multiple queries. As soon as a file is modified, this plugin reads it and tries to locate queries to serialize. It starts by removing all the serialized queries, recognized by the `<!--SerializedQuery: END -->`line. Then, it serializes all the found queries to Markdown and saves the file again.
3446

0 commit comments

Comments
 (0)