Skip to content

Commit

Permalink
Update documents
Browse files Browse the repository at this point in the history
  • Loading branch information
pyrochlore committed Apr 19, 2021
1 parent a53a0d2 commit a2e1eca
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 26 deletions.
53 changes: 32 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# Obsidian Tracker Plugin
![GitHub release](https://img.shields.io/github/v/release/pyrochlore/obsidian-tracker)

This is an [Obsidian](https://obsidian.md/) plugin that helps you track tags and/or texts in daily notes.

For example, one can track simple tag (#exercise-pushup), value-attached tag (#weight:60kg), nested tag (#finance/bank1/transfer:100000USD) or text ('⭐', 'love', '👍', or '👎') over a specified period of time. Currently, a line chart or a summary will be generated to represent the tracked result.
This is an [Obsidian](https://obsidian.md/) plugin that helps you do tracking in daily notes. You can track:
tags
track the number of occurrences of in-line tags (e.g. #meditation)
track the number of occurrences of front matter tags (e.g. tags: meditation)
track the value after a tag (e.g. #weight:60.5kg)
track the value after a nested inline tag (e.g. #finance/bank1/transfer:100000USD and the parent tag #finance/bank1)
front matter key-value pairs
track the value of a key in the front matter (e.g. mood: 10)
wiki links
track the number of occurrences of wiki links (e.g. [[journal]])
text
track the number of occurrences of texts (e.g. '⭐', 'love', or any text that matches your regex expression)
track the value embedded in texts using regular expression (e.g. walk 1000 steps, weightlifting: 50)

<img src="https://raw.githubusercontent.com/pyrochlore/obsidian-tracker/master/docs/images/Screenshot_v1.1.png" width="800">

Expand All @@ -19,7 +29,7 @@ For example, one can track simple tag (#exercise-pushup), value-attached tag (#w
Download the latest [release](https://github.com/pyrochlore/obsidian-tracker/releases). Extract and put the three files (main.js, manifest.json, styles.css) to folder '{{obsidian_vault}}/.obsidian/plugins/obsidian-tracker'.

## Usage
1. Have some tags or texts you want to track in daily notes. Take a look at [Target Evaluation](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/TargetEvaluation.md) to know what you can track.
1. Have some tags or texts you want to track in daily notes. Take a look at [Target Evaluation](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/TargetEvaluation.md) for what you can track and how targets are evaluated as numbers.
2. Add a new note for displaying the tracker.
3. Add tracker code blocks manually or using commands. See [Commands](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/Commands.md) for more detail.
4. Switch the document view mode to 'Preview', then the code block will get rendered.
Expand All @@ -31,33 +41,34 @@ For more use cases, please take a look at [examples](https://github.com/pyrochlo
## Concepts
This plugin was designed to read code blocks in [YAML format](https://en.wikipedia.org/wiki/YAML). The key-value pairs in the code blocks tell the plugin what data to collect and how to render the result.

[Here](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/KeyValuePairs.md) are all the keys defined in this plugin. They are used for collecting data, evaluating targets, data preprocessing, and rendering output.
[Here](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/InputParameters.md) are all the parameters (key-value pairs) defined in this plugin. They are used for collecting data, evaluating targets, data preprocessing, and rendering output.

### Collecting Data
Providing key '**searchType**' and '**searchTarget**' is the minimum requirement for a successful data collection. The value of key '**searchType**' can be '**tag**' or '**text**', while the '**searchTarget**' is the name of a tag or a piece of text you want to search.
Providing key '**searchType**' and '**searchTarget**' is the minimum requirement for a successful data collection and rendering. The value of key '**searchType**' can be '**tag**', '**frontmatter**', '**wiki**', or '**text**', and the cooresponding '**searchTarget**' is the name of a tag or a piece of text as your search target.

### Target Evaluation
Depends on the searchType and the format of your targets, target evaluation can be different. Obsidian-tracker supports tracking simple tags, value-attached tags, nested tags, and text.
Depends on the searchType and the format of your targets, the target evaluation would be different. You can simply track the occurrences of a target or track value attached or embedded in it.

For more information about the tag evaluation, please check documents for [Target Evaluation](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/TargetEvaluation.md)

### Rendering Output
Currently, obsidian-tracker provides two kinds of rendering output, 'line chart', and 'summary'.
Currently, obsidian-tracker provides two kinds of rendering output, the default one 'line' for line chart and 'summary' for text description.

The default rendering output is 'line chart'. If key '**summary**' is not found at the YAML root, the output will be always 'line chart', otherwise, it will render 'summary' as output. You can use [pre-defined template variables](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/TextExpansion.md) in text template (key '**template**' under key '**summary**').
For 'line' output, the plugin will generate a customizable line chart. For 'summary' output, you can use [pre-defined template variables](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/TemplateVariables.md) in text template (key '**template**' under key '**summary**').

Description of keys for rendering line-chart and summary output can be found [here](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/KeyValuePairs.md)
Description of keys for rendering line-chart and summary output can be found [here](https://github.com/pyrochlore/obsidian-tracker/blob/master/docs/InputParameters.md)

### Plugin Settings
You can set the default folder location and date format in the plugin's settings panel. You can also override them by key '**folder**' and '**dateFormat**' in the code block respectively.

Here is the list of default settings.

| Setting Item | Default | Description |
|:--------:|:-------:|:---------:|
| Default folder location | Root of the vault | The folder your daily notes reside |
| Default date format | YYYY-MM-DD | The date format of your daily note title |
Plugin settings 'default folder' and 'default date format, are removed in version 1.2.0. Now the default folder and date format align the settings in the core plugin 'Daily notes'. If the plugin isn't installed, the default values would be '/' and 'YYYY-MM-DD'. You can still override them by using the keys 'folder' and 'dateFormat' in YAML.

## Release Notes
### v1.2.0
- Enable using regular expression in text searching.
- New search type 'frontmatter', searching numerical key-value pair in the front matter.
- New search type 'wiki'.
- Reduce package size.

### v1.1.0
- New output type 'summary'.
- Add commands help create Tracker code blocks.
Expand Down Expand Up @@ -87,16 +98,16 @@ First version released at 2021-03-23.
- [ ] New output type 'heatmap', works like Github calendar heatmap.
- [ ] New output type 'bar', renders bar chart.
- [ ] Support multiple targets and multiple values.
- [ ] Support searching text using regular expression.
- [ ] Support tracking keys other than tags in frontmatter.
- [x] Support searching text using regular expression.
- [x] Support tracking key-value pairs in frontmatter.
- [ ] Add data post-process function, like 'moving average'.
- [ ] Add an 'Explode' button to the rendered blocks, it will replace the code block with the rendered result.
- [ ] Support graphs showing correlation between sets of data
- [ ] Support graphs showing the correlation between sets of data

And more ...

P.S. Items may not be implemented in the order above.

## Support
- If you like this plugin or want to support further development, you can [Buy Me a Coffee](https://www.buymeacoffee.com/pyrochlore).
- Please report bugs and request features in [GitHub Issues](https://github.com/pyrochlore/obsidian-tracker/issues)
- Please report bugs and request features in [GitHub Issues](https://github.com/pyrochlore/obsidian-tracker/issues)
31 changes: 26 additions & 5 deletions docs/TargetEvaluation.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
# Target Evaluation
If the assigned '**searchType**' is '**tag**', tags in your daily notes will be counted and evaluated. You should use the tag name (the name after #) as the value of key '**searchTarget**' or use quoted tag ('**#tagName**') to make it work.

A simple tag is a tag in the format of '*#tagName*'. They will be evaluated as a constant value (default value 1.0). You can change the value by assigning the key '**constValue**' in the code block.
According to the [input parameters](InputParameters.md), the provided search target will be counted or evaluated as a value. Obsidian-tracker supports four kinds of searchType: 'tag', 'frontmatter', 'wiki', and 'text', dealing with different types of searching condition.

The unique feature in the obsidian-tracker is to identify the value-attached tag. Users can attach a value after the tag in the format of '*#tagName:value*'. Note the value should be appended right after your tag and an extra colon without spaces. If a value is attached this way, the obsidian-tracker will use the provided value instead of the constant one.
## tag

Nested tags are also supported. One can use them to track parent-tag and children-tags separately. It's worth noting that frontmatter tags are also included but can only be treated as simple tags. Currently, Obsidian will treat tags with different values as different tags.
Simple tags in the format of '*#tagName*' in the file content are evaluated as a constant value (default value 1.0). You can override the value by assigning the key '**constValue**' in the code block. Use the tag name (the name after #) as the value of key '**searchTarget**' or use quoted tag ('**#tagName**') to make it work.

If the assigned '**searchType**' is '**text**', texts will be counted and simply evaluated by occurrence.
For tags in frontmatter (e.g. tags: meditation), it works like simple tags and will be evaluated as a constant value. For example,
```
tags: tagName1, tagName2
```
Set '**searchTarget**' to tagName1 or tagName2 do the work.

In your content, a value can be attached to the tag in the format of '*#tagName:value*'. Note the value should be appended right after your tag and an extra colon without spaces. If a value is attached this way, the obsidian-tracker will automatically use the provided value instead of the constant one.

Nested tags with values attached could be useful for tracking children's data separately and also still see the overall merged data using parent tags.

If you don't want value-attached tags in your content, you can use the '**frontmatter**' target.

## frontmatter
This search type is used to query the key-value pairs in the front matter. If you don't want these values been seen in your article, the front matter would be the best place to record. For example,
```
mood: 10
```

## wiki
This search type helps you count wiki links in articles.

## text
searchType 'text' is the most powerful one among all. If you simply provide text like 'love', the number of occurrences of tags will be counted. You can provide a regular expression to search for a very complicated target by wrapping it in single quotes. If you want to retrieve a value from it, use the group name in the expression. To see more detail, see [this case](TrackWithRegex.md).

0 comments on commit a2e1eca

Please sign in to comment.