pull/1059/head
Zef Hemel 2024-08-21 21:30:29 +02:00
parent b1c46a17cf
commit d0ed24aae5
3 changed files with 36 additions and 18 deletions

View File

@ -34,7 +34,7 @@ export type ItemObject = ObjectValue<
export async function indexItems({ name, tree }: IndexTreeEvent) { export async function indexItems({ name, tree }: IndexTreeEvent) {
const items = await extractItems(name, tree); const items = await extractItems(name, tree);
console.log("Found", items, "item(s)"); // console.log("Found", items, "item(s)");
await indexObjects(name, items); await indexObjects(name, items);
} }
@ -53,6 +53,12 @@ export async function extractItems(name: string, tree: ParseTree) {
return true; return true;
} }
// Is this a task?
if (n.children.find((n) => n.type === "Task")) {
// Skip tasks
return true;
}
const item: ItemObject = await extractItemFromNode( const item: ItemObject = await extractItemFromNode(
name, name,
n, n,

View File

@ -5,7 +5,8 @@ An attempt at documenting the changes/new features introduced in each release.
## Edge ## Edge
_These features are not yet properly released, you need to use [the edge builds](https://community.silverbullet.md/t/living-on-the-edge-builds/27) to try them._ _These features are not yet properly released, you need to use [the edge builds](https://community.silverbullet.md/t/living-on-the-edge-builds/27) to try them._
* Nothing new since 0.9.1 * Slashes in page names are no no longer URL encoded (in the URL)
* `task` and `item` [[Objects]] now have a `parent` attribute when nested, and inherit their ancestors tags in `itags` see [[Objects#item]] for an example.
## 0.9.1 ## 0.9.1
* Widget buttons for [[Transclusions]] (by [onespaceman](https://github.com/silverbulletmd/silverbullet/pull/1013)) as well as some other transclusion-related fixes * Widget buttons for [[Transclusions]] (by [onespaceman](https://github.com/silverbulletmd/silverbullet/pull/1013)) as well as some other transclusion-related fixes

View File

@ -55,9 +55,31 @@ table
Table headers will be normalized by converting them to lowercase and replacing all non alphanumeric characters with `_`. Table headers will be normalized by converting them to lowercase and replacing all non alphanumeric characters with `_`.
## task ## item
List items (both bullet point and numbered items) are indexed with the `item` tag, and additional tags can be added using [[Tags]].
task Here is an example of a #quote item using a custom [[Attributes|attribute]]:
* “If you dont know where youre going you may not get there.” [by: Yogi Berra] #quote
And then queried via the #quote tag:
```query
quote where page = @page.name and tag = "item" select name, by
```
When items are nested, they will contain a `parent` attrite with a reference to their parent. In addition, `itags` will also inherit their ancestors tags. For instance:
* Root item #root-tag
* Sub item #sub-tag
* Leaf item
The `Leaf item` will be indexed as follows:
```query
item where page = @page.name and name = "Leaf item" select name, parent, itags
```
## task
Every task in your space is tagged with the `task` tag by default. You tag it with additional tags by using [[Tags]] in the task name, e.g. Every task in your space is tagged with the `task` tag by default. You tag it with additional tags by using [[Tags]] in the task name, e.g.
* [ ] My task #upnext * [ ] My task #upnext
@ -76,6 +98,9 @@ Although you may want to render it using a template such as [[Library/Core/Query
upnext render [[Library/Core/Query/Task]] upnext render [[Library/Core/Query/Task]]
``` ```
Similar to [[#item]], `task` objects have a `parent` attribute when nested (pointing to their parent `item`), and inherit their ancestors tags in `itags`.
## taskstate ## taskstate
[[Plugs/Tasks]] support the default `x` and ` ` states (done and not done), but custom states as well. Custom states used across your space are kept in `taskstate`: [[Plugs/Tasks]] support the default `x` and ` ` states (done and not done), but custom states as well. Custom states used across your space are kept in `taskstate`:
@ -95,20 +120,6 @@ Indexes all pages tagged with `#template`. See [[Templates]] for more informatio
template select name limit 5 template select name limit 5
``` ```
## item
List items (both bullet point and numbered items) are indexed with the `item` tag, and additional tags can be added using [[Tags]].
Here is an example of a #quote item using a custom [[Attributes|attribute]]:
* “If you dont know where youre going you may not get there.” [by: Yogi Berra] #quote
And then queried via the #quote tag:
```query
quote where page = @page.name and tag = "item" select name, by
```
## paragraph ## paragraph
Top-level paragraphs (that is: paragraphs not embedded in a list) are indexed using the `paragraph` tag, any additional tags can be added using [[Tags]]. Top-level paragraphs (that is: paragraphs not embedded in a list) are indexed using the `paragraph` tag, any additional tags can be added using [[Tags]].