Skip to content

Commit 611a16d

Browse files
committed
docs: cut v2.3.0 docs
1 parent 1279fc2 commit 611a16d

File tree

16 files changed

+962
-0
lines changed

16 files changed

+962
-0
lines changed

docs/versioned_docs/version-2.3.0/changelog.md

Lines changed: 468 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
label: Commands
2+
position: 4
744 KB
Loading
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
5+
# Add task
6+
7+
![](./add-task-modal.png)
8+
9+
The 'Add task' set of commands open up a modal that allows you to configure and send tasks to Todoist from Obsidian. Any text selected will be used to pre-populate the task content.
10+
11+
There are a few variants of the command:
12+
13+
- 'Add task', the basic version
14+
- 'Add task with current page in task content', this option will append a link to the current page in the task content before it sends it to Obsidian. The modal will inform you it will do this, but the link is not shown to keep the modal clean.
15+
- 'Add task with current page in task description', this option will append a link to the current page in the task description before it sends it to Obsidian. The modal will inform you it will do this, but the link is not shown to keep the modal clean.
16+
17+
## Copy markdown link after creating task
18+
19+
The 'Add task' button in the modal is a split button with a dropdown menu. You can click the dropdown arrow to choose between three actions:
20+
21+
- **Add task** - Creates the task without copying anything
22+
- **Add task and copy link (app)** - Creates the task and copies a markdown link with an app URI (`todoist://task?id=...`)
23+
- **Add task and copy link (web)** - Creates the task and copies a markdown link with a web URL (`https://todoist.com/app/project/...`)
24+
25+
The markdown link format is `[task content](url)`, which you can paste directly into your Obsidian notes. The link will open the task in Todoist when clicked.
26+
27+
You can set your preferred default action in the plugin settings under "Task creation" → "Default add task action".
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
sidebar_position: 2
3+
---
4+
5+
# Sync with Todoist
6+
7+
The 'Sync with Todoist' command forces the plugin to re-synchronize your labels, projects, and sections with Todoist. This can be useful if you see "Unknown Project", "Unknown Section", or "Unknown Label" in any rendered tasks.
8+
9+
The plugin pulls this information at startup, but will not refresh it automatically because:
10+
11+
- its expected that these don't change frequently
12+
- to help avoid hitting the Todoist API rate limit
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
sidebar_position: 5
3+
---
4+
5+
# Configuration
6+
7+
There are a number of options that allow you to configure the behaviour of the plugin. These are listed below, but the settings page also gives brief descriptions.
8+
9+
## General
10+
11+
### Todoist API token
12+
13+
The API token used to connect to Todoist. This is stored in your vault at `.obsidian/todoist-token`. If you synchronize your vault, I recommend that you do _not_ sync this file for security reasons.
14+
15+
## Auto-refresh
16+
17+
### Auto-refresh enabled
18+
19+
When enabled, all queries will auto-refresh themselves according to the interval in the settings.
20+
21+
### Auto-refresh interval
22+
23+
This defines, in seconds, the interval between automatic refreshes. This is only used when:
24+
25+
- the auto-refresh is enabled in the settings
26+
- the query does not define an explicit interval
27+
28+
## Rendering
29+
30+
### Task fade animation
31+
32+
When enabled, tasks will fade-in or fade-out when tasks are added or removed respectively. Just some eye candy if you like that.
33+
34+
### Render date icon
35+
36+
When enabled, queries will render an icon accompanying the due date.
37+
38+
### Render project & section icon
39+
40+
When enabled, queries will render an icon accompanying the project & section.
41+
42+
### Render labels icon
43+
44+
When enabled, queries will render an icon accompanying the labels.
45+
46+
## Task creation
47+
48+
### Add parenthesis to page links
49+
50+
When enabled, page links added to tasks created via the [command](./commands/add-task) will be wrapped in parenthesis. This may help identifying links if you primarily use Todoist on mobile platforms.
51+
52+
### Add task button adds page link
53+
54+
When enabled, the embedded add task button in queries will add a link to the page to the task in the specified place. This behaviour can also be disabled completely.
55+
56+
### Default due date
57+
58+
This defines the default due date assigned to tasks created via [commands](./commands/add-task). This can be one of: none, today, or tomorrow.
59+
60+
### Default project
61+
62+
This defines the default project assigned to tasks created via [commands](./commands/add-task). This can be configured to any of your projects, or the Inbox.
63+
64+
If the project referenced here no longer exists, you will get a warning when opening the task creation modal and the Inbox will be used instead.
65+
66+
### Default labels
67+
68+
This defines the default labels assigned to tasks created via [commands](./commands/add-task). You can select zero, one, or multiple labels to be automatically applied to new tasks.
69+
70+
If any of the selected labels no longer exist in Todoist, you will get a warning when opening the task creation modal and they will be skipped.
71+
72+
### Default add task action
73+
74+
This setting controls the default action for the 'Add task' button in the task creation modal. You can choose between:
75+
76+
- **Add task** - Creates the task without copying a link
77+
- **Add task and copy link (app)** - Creates the task and copies a markdown-formatted link using the Todoist app URI
78+
- **Add task and copy link (web)** - Creates the task and copies a markdown-formatted link using the Todoist web URL
79+
80+
This sets the initial button action when opening the modal, but you can change it per-task using the split button dropdown. See the [Add task command documentation](./commands/add-task#copy-markdown-link-after-creating-task) for more details.
81+
82+
## Advanced
83+
84+
### Debug logging
85+
86+
When enabled, the plugin will print extra information to the Developer Tools console. You generally do not need to enable this.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
label: Contributing
2+
position: 6
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# General
2+
3+
## Prerequisites
4+
5+
This plugin is built using Typescript and React. You will need the following tools installed to build and run the plugin:
6+
7+
- [`git`](https://git-scm.com/downloads)
8+
- [`npm`](https://nodejs.org/en/download/)
9+
10+
Alternatively, if you use Nix, there is a flake and a `.envrc` to load the development environment for you. Simply run `direnv allow` to load the environment.
11+
12+
## Building
13+
14+
The plugin source is contained entirely within the `plugin` directory. To build the plugin:
15+
16+
1. Run `cd plugin`
17+
2. Run `npm install` to pull down the required dependencies
18+
3. Run `npm run dev` to build the plugin.
19+
20+
By default, this will build the plugin into `plugin/dist/`. You can manually copy the files an Obsidian vault for testing. For a smoother iteration cycle, you can tell the build process where it should place the output. The build process looks for the `VITE_OBSIDIAN_VAULT` environment variable to find a target vault.
21+
22+
A simple way to configure this once is:
23+
24+
1. Create a file at `plugin/.env.local`. This file is automatically loaded by the build script.
25+
2. Add a line to this file setting the environment variable. For example:
26+
27+
```sh
28+
export VITE_OBSIDIAN_VAULT=/Users/jamiebrynes/Documents/my-vault
29+
```
30+
31+
## Running tests
32+
33+
Its generally a good idea to write tests to ensure that the plugin's functionality is correct. The test suite is, at the time of writing, limited - but it can be useful for developing functionality against a set of tests. To run _all_ tests, from the `plugin` directory:
34+
35+
```
36+
npm run test
37+
```
38+
39+
Alternatively, to run a subset of tests, you can pass in a path to filter the tests ran:
40+
41+
```
42+
npm run test ./src/utils
43+
```
44+
45+
## Linting
46+
47+
This plugin uses [BiomeJS](https://biomejs.dev/) to format and lint our Typescript. This ensures a consistent code style across the plugin. To check the formatting, from the `plugin` directory, run:
48+
49+
```
50+
npm run lint:check
51+
```
52+
53+
Biome can also format code to fix most issues. Note this will modify files on disk:
54+
55+
```
56+
npm run lint:fix
57+
```
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Release Process
2+
3+
This is a brief guide on how to release a new version of the plugin.
4+
5+
1. Update changelog with release version + date.
6+
2. If minor or major release, cut a new version of the docs with `npm run bump-version -- ${VERSION}` in the `docs` directory.
7+
3. Update the versions in:
8+
1. `manifest.json`
9+
2. `package.json`
10+
3. `versions.json`
11+
4. Open a PR + merge
12+
5. Tag the release with `git tag -a ${VERSION}` and push the tag with `git push origin ${VERSION}`
13+
6. Wait for the release build to complete.
14+
7. Update the generated release with the changelog and publish.
15+
8. Test the update in Obsidian.
16+
17+
Note that between steps 4 and 6, there is a period of time where the plugin's `manifest.json` specified version does not have a release associated with it. This only lasts a minute or two, so the impact should be minimal.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import { TranslationStatus } from "@site/src/components/TranslationStatus";
2+
import translationData from "../translation-status.json";
3+
4+
# Translations
5+
6+
Before getting started, you should ensure you read the general [contribution guide](./general). This will ensure that you have a working build environment and are ready to go!
7+
8+
## Status
9+
10+
<TranslationStatus data={translationData} />
11+
12+
## Architecture
13+
14+
It can be useful to understand how the translation system works in this plugin. At startup, the plugin will set the language based on the `lang` attribute in the root `html` element. This ensures that it follows the language set in the general Obsidian settings. A consequence of this is that we are restricted to the [languages supported by Obsidian](https://github.com/obsidianmd/obsidian-translations#existing-languages).
15+
16+
The translations are effectively a large key-value store. You can see all of the keys and the structure in `plugin/src/i18n/translations.ts`. The location of the translation phrase (or function) in the `Translations` type should give a suggestion as to where it is used. For example, `translations.settings.autoRefresh.header` refers to the header of the auto-refresh settings section.
17+
18+
The plugin can consume the translations by calling the `t()` function exported from `i18n` to get the currently resolved translations. This object is marked as `readonly` so that it can't be modified. For example:
19+
20+
```ts
21+
import { t } from "@/i18n";
22+
23+
const i18n = t();
24+
25+
const getSettingsHeader = () => {
26+
return i18n.settings.general.header;
27+
};
28+
```
29+
30+
If a language does not have a translation for a particular key, the plugin will fall back to the English translation.
31+
32+
## Adding a new language
33+
34+
There is a guide in `plugin/src/i18n/index.ts` that explains how to add a new language. This is repeated here for convenience:
35+
36+
1. Identify the language code for the language you want to add. You can find this by searching for the language in the [Obsidian translations repo](https://github.com/obsidianmd/obsidian-translations).
37+
2. Create a file in the `plugin/src/i18n/langs` directory with language code as the filename. For example, if you were to add a translation for French, you would create `plugin/src/i18n/langs/fr.ts`.
38+
3. Copy the template below into the new file. Make sure to replace $langCode with the language code:
39+
40+
```ts
41+
import type { Translations } from "@/i18n/translation";
42+
import type { DeepPartial } from "@/utils/types";
43+
44+
export const $langCode: DeepPartial<Translations> = {};
45+
```
46+
47+
4. Register the language in the registry at the bottom of `plugin/src/i18n/index.ts`. The key should be the language code and the value should be the object exported in the previous step. You will need to add an import for the new file. For example:
48+
49+
```ts
50+
// plugin/src/i18n/index.ts
51+
import { fr } from "@/i18n/langs/fr";
52+
53+
// A bunch of things you don't need to worry about...
54+
55+
const registry: Record<string, DeepPartial<Translations>> = {
56+
fr: {
57+
name: "Français",
58+
code: "fr",
59+
translations: fr,
60+
},
61+
};
62+
```
63+
64+
5. Proceed to [adding translated phrases](#adding-translated-phrases).
65+
66+
## Adding translated phrases
67+
68+
In order to add translated phrases, you will first need to identify the key for the phrase. The easiest way to do this is to search for the English phrase in the `plugin/src/i18n/langs/en.ts` file.
69+
70+
For example, if I wanted to translate the phrase "Rendering" in the settings, I would search for "Rendering" in the `plugin/src/i18n/langs/en.ts` file. I would find that the key is `settings.rendering.header`.
71+
72+
Then, open the file for the language you want to add the translation to. For example, if I wanted to add the translation to French, I would open `plugin/src/i18n/langs/fr.ts`. If the language doesn't exist, please see [the section above](#adding-a-new-language).
73+
74+
Then I would ld add the translation to the object. You may need to create the object path if it doesn't exist. For example, let's assume that there were no translations for French, I would need to add the following structure:
75+
76+
```ts
77+
export const fr: DeepPartial<Translations> = {
78+
settings: {
79+
rendering: {
80+
header: "translation of 'Rendering'",
81+
},
82+
},
83+
};
84+
```

0 commit comments

Comments
 (0)