-
-
Notifications
You must be signed in to change notification settings - Fork 91
Autotagging
You can optionally define keywords for common tasks and projects in your .doingrc
file. Keywords in your entries can trigger automatic tagging, just to make life easier. There are four tools available: default tags, whitelisting, synonym tagging, and tag transformation.
Default tags are tags that are applied to every entry. You probably don't want to add these in the root configuration, but using a local .doingrc
in a project directory that defines default tags for that project allows anything added from that directory to be tagged automatically. A local .doingrc
in my Marked development directory might contain:
---
default_tags: [marked,coding]
And anything I enter while in the directory gets tagged with @marked and @coding.
A whitelist is a list of words that should be converted directly into @tags. If my whitelist contains "design" and I type doing now working on site design
, that's automatically converted to "working on site @design."
Synonyms allow you to define keywords that will trigger their parent tag. If I have a tag called @design, I can add "typography" as a synonym. Then entering doing now working on site typography
will become "working on site typography @design."
White lists and synonyms are defined like this:
autotag:
synonyms:
design:
- typography
- layout
brainstorming
- thinking
- idea
whitelist:
- brainstorming
- coding
YAML note: When defining synonym
keys, be sure to indent but not hyphenate the parent keys (design and brainstorm above), while hyphenating the list of synonyms at the same indent level as the parent key.
Note that you can include a tag with synonyms in the whitelist as well to tag it directly when used.
You can include a transform
section in the autotag config which contains pairs of regular expressions and replacement patterns separated by a colon. These will be used to look at existing tags in the text and generate additional tags from them. For example:
autotag:
transform:
- (\w+)-\d+:$1
This creates a search pattern looking for a string of word characters followed by a hyphen and one or more digits, e.g. @projecttag-12
. Do not include the @ symbol in the pattern. The replacement ($1
) indicates that the first matched group (in parenthesis) should be used to generate the new tag, resulting in @projecttag
being added to the entry.
You can convert a tag into multiple tags by separating the new tags with a space in the replacement, e.g. project1:work project
. Now Tackling @project1
becomes tackling @project1 @work @project
.
Transformed tags are added at the end of the title. If you want the transformation to happen in place, replacing the matched tag, add /r
at the end of the replacement, e.g. whistling:work topsecret/r
. Now walking away @whistling
becomes walking away @work @topsecret
.