Skip to content

Commit 2bf690a

Browse files
committed
Merge branch 'curious-archaea-master'
2 parents 5d0d52c + 04262dc commit 2bf690a

23 files changed

Lines changed: 251 additions & 9 deletions

docs/Concepts.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ This plugin was designed to read code blocks in [YAML format](https://en.wikiped
66

77
### Collecting Data
88

9-
Providing parameters `searchType` and `searchTarget` is the minimum requirement for a successful data collection. `searchType` can be `tag`, `frontmatter`, `wiki`, `dvField`, `table`, `fileMeta`, `task`, or `text`. Then the cooresponding `searchTarget` should be provided according to the specified type.
9+
Providing parameters `searchType` and `searchTarget` is the minimum requirement for a successful data collection. `searchType` can be `tag`, `frontmatter`, `frontmatterlist`, `wiki`, `dvField`, `table`, `fileMeta`, `task`, or `text`. Then the cooresponding `searchTarget` should be provided according to the specified type.
1010

1111
### Target Evaluation
1212

13-
Depends on the `searchType` and the `searchTarget` you provided, the evaluation of a target would be different. Simply speaking, you can track the occurrences of a target or the value attached/embedded in it.
13+
Depending on the `searchType` and the `searchTarget` you provided, the evaluation of a target would be different. Simply speaking, you can track the occurrences of a target or the value attached/embedded in it.
1414

1515
To see the detail about the target evaluation, please check the document [Target Evaluation](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/TargetEvaluation.md).
1616

docs/Examples.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Check where (Location) and what (Target to Track) is your target and find the se
3535
| content | - [x] Say love<br>- [ ] Say love | searchType:task<br>searchTarget: Say love | O |
3636
| content | - [x] Say love | searchType:task.done<br>searchTarget: Say love | O |
3737
| content | - [ ] Say love | searchType: task.notdone<br>searchTarget: Say love | O |
38+
| frontmatter | habits: spanish, piano, yoga<br>([more examples](https://github.com/curious-archaea/obsidian-tracker/blob/master/docs/TargetEvaluation.md#Formatting-property-values-in-frontmatter))| searchType: frontmatterlist<br>searchTarget: habits[spanish] | O |
3839

3940
## Full examples
4041

@@ -54,6 +55,7 @@ List of all examples
5455
- [Dataview Inline Field](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestDvField.md)
5556
- [Expression](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestExpression.md)
5657
- [File Meta](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestFileMeta.md)
58+
- [Frontmatter Lists](https://github.com/curious-archaea/obsidian-tracker/blob/master/examples/TestFrontmatterList.md) (New!)
5759
- [Legends](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestLegends.md)
5860
- [Multiple Targets / Multiple Values](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestMultipleTargetsMultipleValues.md)
5961
- [Pie Chart](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/TestPieChart.md)

docs/TargetEvaluation.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Target Evaluation
22

3-
From the [input parameters](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/InputParameters.md) you provided, the search targets dispersed in the notes will be counted or evaluated as a value. Tracker plugin supports eight kinds of `searchType`: `tag`, `frontmatter`, `wiki`, `text`, `table`, `dvField`, `task`, and `fileMeta`, dealing with different types of searching condition.
3+
From the [input parameters](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/InputParameters.md) you provided, the search targets dispersed in the notes will be counted or evaluated as a value. Tracker plugin supports nine kinds of `searchType`: `tag`, `frontmatter`, `frontmatterlist`, `wiki`, `text`, `table`, `dvField`, `task`, and `fileMeta`, dealing with different types of searching condition.
44

55
## Multiple Targets
66
You can provide multiple search targets in code block by entering an array of targets separated by a comma under parameter `searchType` and `searchTarget`. Each of the targets will be identified in order and then the values in notes will be evaluated and form a dataset indexed by that order in the array (zero-based indexing).
@@ -21,6 +21,8 @@ Many other parameters that accept multiple values (e.g. lineColor) can also be p
2121

2222
Multiple values under a target (value tuple) separated by a slash, e.g. #bloodpressure:180/120mmHg, are supported after version 1.3.0. To identify a specific value as a target, use an accessor with bracket notation where the value in the bracket is the index by the order of values. In this case, they are bloodpressure[0] and bloodpressure[1]. You can find the example of this [here](https://github.com/pyrochlore/obsidian-tracker/blob/master/examples/BloodPressureTracker.md). You can also use a custom separator by using the parameter `separator`.
2323

24+
**Note**: the bracket notation used with searchType: frontmatterlist (e.g. habits[yoga]) uses the same bracket syntax but serves a different purpose. It specifies a string value to match against a list, rather than a numeric index into a tuple. The two are not interchangeable.
25+
2426
## Search Target in Detail
2527

2628
### searchType: tag
@@ -51,6 +53,42 @@ mood: 10<br>
5153
......<br>
5254
\-\-\-<br>
5355

56+
### searchType: frontmatterlist
57+
This option is for vaultkeepers who want to use the same custom YAML property to track multiple targets. It is useful for tracking habits or categories recorded as a list in front matter fields *other* than tags.
58+
59+
This search type checks whether a specific value is present in a frontmatter key that holds a list. Ex:
60+
```
61+
habits: [habitA, habitB, habitC]
62+
```
63+
64+
When specifying a searchTarget, use the key name followed by the member value in bracket notation:
65+
```
66+
searchType: frontmatterlist
67+
searchTarget: habits[spanish]
68+
```
69+
When the member value is present in the list, it will be evaluated as a constant value (default 1.0). When it is absent, the day will have no value. This is ideal for counting occurances.
70+
71+
#### Formatting property values in frontmatter
72+
73+
Like tags, values stored in frontmatter lists are **case insensitive**. (ex: `piano` and `Piano` should be treated the same.)
74+
75+
**Single-line lists** can optionally be surrounded by square brackets, but it's not required. Any of the following will work in frontmatter and evaluate without issue:
76+
- `habits: `
77+
- `habits: []`
78+
- `habits: spanish`
79+
- `habits: [spanish]`
80+
- `habits: yoga, spanish, piano`
81+
- `habits: [yoga, spanish, piano]`
82+
83+
**Multi-line lists** are also allowed, ex:
84+
```
85+
habits:
86+
- yoga
87+
- spanish
88+
- piano
89+
```
90+
91+
5492
### searchType: wiki
5593
This search type helps you count wiki links in articles. For example,
5694
[[A]]

examples/TestFrontmatter.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ line:
3636
```
3737

3838
## Multiple Tags in Front Matter
39-
Extract data of one tag from multiple tags
39+
Extract data of one tag from multiple tags.
4040
The default separator in front matter tags is comma (,)
4141
``` tracker
4242
searchType: tag
@@ -54,7 +54,7 @@ line:
5454
pointBorderColor: "#d65d0e"
5555
```
5656

57-
Use the data of two tags
57+
Use the data of two tags.
5858
The default separator in front matter tags is comma (,)
5959
``` tracker
6060
searchType: tag
@@ -65,4 +65,7 @@ month:
6565
initMonth: 2021-01
6666
```
6767

68-
Please also check those search targets in markdown files under folder 'diary'.
68+
Please also check those search targets in markdown files under folder 'diary'.
69+
70+
71+
Note about multiple values: When extracting one value from a list of multiple values in frontmatter fields besides tags, please refer to TestFrontmatterList.md.

examples/TestFrontmatterList.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Frontmatter Lists
2+
This option is helpful for vaultkeepers who want to track multiple habits (targets) using the same custom YAML property.
3+
4+
## Example outputs
5+
Each of the outputs below is generated by searching frontmatter for `habits: ` , then checking the list of values for the presence of a single habit, ex: `yoga`, `piano`, or `spanish`.
6+
7+
```tracker
8+
searchType: frontmatterlist
9+
searchTarget: habits[yoga]
10+
folder: diary
11+
startDate: 2026-02-01
12+
endDate: 2026-02-28
13+
datasetName: Yoga
14+
month:
15+
```
16+
17+
18+
19+
```tracker
20+
searchType: frontmatterlist
21+
searchTarget: habits[spanish]
22+
folder: diary
23+
startDate: 2026-02-01
24+
endDate: 2026-02-28
25+
datasetName: Spanish
26+
month:
27+
color: orange
28+
```
29+
```tracker
30+
searchType: frontmatterlist
31+
searchTarget: habits[piano]
32+
folder: diary
33+
startDate: 2026-02-01
34+
endDate: 2026-02-28
35+
datasetName: Piano
36+
month:
37+
color: lightblue
38+
```
39+
40+
```tracker
41+
searchType: frontmatterlist
42+
searchTarget: habits[piano]
43+
folder: diary
44+
startDate: 2026-02-01
45+
endDate: 2026-02-28
46+
summary:
47+
template: "Total count: {{sum()}}"
48+
```
49+
50+
51+
52+
### Testing
53+
54+
**Bracket test**: Single-line lists can be surrounded by square brackets, but it's not required. (Trailing commas won't break anything either.)
55+
- 2/9: `habits: []`
56+
- 2/10: `habits: [piano]`
57+
- 2/12: `habits: [yoga, spanish]`
58+
- 2/16: `habits: `
59+
- 2/8: `habits: spanish`
60+
- 2/15: `habits: yoga, spanish, piano`
61+
62+
.
63+
64+
**Case test**: Values stored in frontmatter lists are **case insensitive** for this plugin, mirroring the behavior of tags. In the examples above, `yoga` and `Yoga` should be treated the same.
65+
66+
If search targets are case insensitive, then both 2/14 and 2/17 will be highlighted on the `month:` output for `habit[yoga]` when the examples vault is viewed in Obsidian.
67+
68+
.
69+
70+
**Multi-line list test**: If multi-line lists are working, then 2/14 will be highlighted on each of the calendars above when the examples vault is viewed in Obsidian.
71+
```
72+
habits:
73+
- yoga
74+
- spanish
75+
- piano
76+
```

examples/diary/2026-02-08.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
habits: spanish
3+
---

examples/diary/2026-02-09.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
habits: []
3+
---
4+
Punxsutawney Phil was right :(

examples/diary/2026-02-10.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
habits: [piano]
3+
---
4+
boop beep

examples/diary/2026-02-11.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
habits: [yoga, spanish, piano]
3+
---
4+
build all the habits

examples/diary/2026-02-12.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
habits: [yoga, spanish]
3+
---

0 commit comments

Comments
 (0)