Skip to content

Commit 9694dd0

Browse files
Mike Greinerclaude
andcommitted
Merge upstream/master into feature/issue-280-frontmatter-exists
Resolved conflicts to keep both frontmatter.exists and frontmatterlist features in src/data.ts, src/collecting.ts, src/main.ts, src/parsing.ts, docs, and examples. Used upstream's improved test infrastructure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 parents 6c4cd8e + 7517b66 commit 9694dd0

37 files changed

Lines changed: 2527 additions & 4838 deletions

.github/workflows/releases.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
contents: write
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v4
13+
- uses: actions/checkout@v6
1414
- name: Use Node.js
15-
uses: actions/setup-node@v4
15+
uses: actions/setup-node@v6
1616
with:
1717
node-version: '18.x'
1818
- name: Build

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ This is an [Obsidian](https://obsidian.md/) plugin that helps you collect data f
1010

1111
## What's New
1212

13+
Version 1.18.0
14+
15+
- Support all days for startWeekOn parameter
16+
- Handle numeric YAML parsing for startDate/endDate with YYYYMMDD format
17+
- Add searchType for frontmatter keys containing lists
18+
- Update dependencies
19+
1320
Version 1.17.0
1421

1522
- Adding colorByStreak parameter to Calendars allowing for increase color intensity based on streak

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`, `frontmatter.exists`, `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`, `frontmatter.exists`, `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/pyrochlore/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/pyrochlore/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/ReleaseNotes.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Release Notes
22

3+
## 1.18.0
4+
5+
- Support all days for startWeekOn parameter
6+
- Handle numeric YAML parsing for startDate/endDate with YYYYMMDD format
7+
- Add searchType for frontmatter keys containing lists
8+
- Update dependencies
9+
310
## 1.17.0
411

512
- Adding colorByStreak parameter to Calendars allowing for increase color intensity based on streak

docs/TargetEvaluation.md

Lines changed: 38 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 multiple kinds of `searchType`: `tag`, `frontmatter`, `frontmatter.exists`, `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 multiple kinds of `searchType`: `tag`, `frontmatter`, `frontmatter.exists`, `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
@@ -62,6 +64,41 @@ meditation: yes<br>
6264
......<br>
6365
\-\-\-<br>
6466

67+
### searchType: frontmatterlist
68+
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.
69+
70+
This search type checks whether a specific value is present in a frontmatter key that holds a list. Ex:
71+
```
72+
habits: [habitA, habitB, habitC]
73+
```
74+
75+
When specifying a searchTarget, use the key name followed by the member value in bracket notation:
76+
```
77+
searchType: frontmatterlist
78+
searchTarget: habits[spanish]
79+
```
80+
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.
81+
82+
#### Formatting property values in frontmatter
83+
84+
Like tags, values stored in frontmatter lists are **case insensitive**. (ex: `piano` and `Piano` should be treated the same.)
85+
86+
**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:
87+
- `habits: `
88+
- `habits: []`
89+
- `habits: spanish`
90+
- `habits: [spanish]`
91+
- `habits: yoga, spanish, piano`
92+
- `habits: [yoga, spanish, piano]`
93+
94+
**Multi-line lists** are also allowed, ex:
95+
```
96+
habits:
97+
- yoga
98+
- spanish
99+
- piano
100+
```
101+
65102
### searchType: wiki
66103
This search type helps you count wiki links in articles. For example,
67104
[[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
@@ -82,4 +82,7 @@ month:
8282

8383
This will count each day where the `meditation` field exists in the frontmatter, whether it's `meditation: yes`, `meditation: completed`, `meditation: true`, or any other non-empty value.
8484

85-
Please also check those search targets in markdown files under folder 'diary'.
85+
Please also check those search targets in markdown files under folder 'diary'.
86+
87+
88+
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/TestStartWeekOn.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The `startWeekOn` parameter now accepts any day of the week:
1313

1414
```tracker
1515
searchType: tag
16-
searchTarget: test
16+
searchTarget: meditation
1717
folder: diary
1818
startDate: 2021-01-01
1919
endDate: 2021-01-31
@@ -26,7 +26,7 @@ month:
2626

2727
```tracker
2828
searchType: tag
29-
searchTarget: test
29+
searchTarget: meditation
3030
folder: diary
3131
startDate: 2021-01-01
3232
endDate: 2021-01-31
@@ -39,7 +39,7 @@ month:
3939

4040
```tracker
4141
searchType: tag
42-
searchTarget: test
42+
searchTarget: meditation
4343
folder: diary
4444
startDate: 2021-01-01
4545
endDate: 2021-01-31
@@ -52,7 +52,7 @@ month:
5252

5353
```tracker
5454
searchType: tag
55-
searchTarget: test
55+
searchTarget: meditation
5656
folder: diary
5757
startDate: 2021-01-01
5858
endDate: 2021-01-31
@@ -65,7 +65,7 @@ month:
6565

6666
```tracker
6767
searchType: tag
68-
searchTarget: test
68+
searchTarget: meditation
6969
folder: diary
7070
startDate: 2021-01-01
7171
endDate: 2021-01-31
@@ -78,7 +78,7 @@ month:
7878

7979
```tracker
8080
searchType: tag
81-
searchTarget: test
81+
searchTarget: meditation
8282
folder: diary
8383
startDate: 2021-01-01
8484
endDate: 2021-01-31
@@ -91,7 +91,7 @@ month:
9191

9292
```tracker
9393
searchType: tag
94-
searchTarget: test
94+
searchTarget: meditation
9595
folder: diary
9696
startDate: 2021-01-01
9797
endDate: 2021-01-31

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+
---

0 commit comments

Comments
 (0)