Skip to content

Commit b37a969

Browse files
committed
update developer docs
1 parent f573d86 commit b37a969

File tree

133 files changed

+3211
-822
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+3211
-822
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
maxPreviewsCached: 10
2+
vaults:
3+
-
4+
fsPath: vault
5+
name: dendron.dendron-docs
6+
useFMTitle: true
7+
useNoteTitleForLink: true
8+
noAutoCreateOnDefinition: true
9+
noLegacyNoteRef: true
10+
noXVaultWikiLink: true
11+
mermaid: true
12+
useKatex: true
13+
autoFoldFrontmatter: true
14+
usePrettyRefs: true
15+
dev:
16+
enablePreviewV2: true
17+
journal:
18+
dailyDomain: daily
19+
name: journal
20+
dateFormat: y.MM.dd
21+
addBehavior: childOfDomain
22+
firstDayOfWeek: 1
23+
scratch:
24+
name: scratch
25+
dateFormat: y.MM.dd.HHmmss
26+
addBehavior: asOwnDomain
27+
site:
28+
copyAssets: true
29+
siteHierarchies:
30+
- pkg
31+
siteRootDir: docs
32+
gh_edit_repository: 'https://github.com/dendronhq/dendron-docs'
33+
logo: vault/assets/images/logo.png
34+
siteUrl: 'https://docs.dendron.so'
35+
usePrettyRefs: true
36+
title: Dendron
37+
author: dendronhq
38+
twitter: dendronhq
39+
description: >-
40+
Dendron is a local-first, markdown based, hierarchical note taking tool.
41+
It is meant to help you create, organize, and collaborate on knowledge
42+
bases of any size.
43+
siteLastModified: true
44+
gh_edit_branch: main
45+
duplicateNoteBehavior:
46+
action: useVault
47+
payload:
48+
- vault
49+
version: 2
50+
initializeRemoteVaults: true
51+
useTitleForLink: true
52+
commands:
53+
lookup:
54+
note:
55+
selectionMode: extract
56+
confirmVaultOnCreate: false
57+
leaveTrace: false
58+
randomNote: {}
59+
insertNote:
60+
initialValue: templates
61+
insertNoteLink:
62+
aliasMode: none
63+
enableMultiSelect: false
64+
insertNoteIndex:
65+
enableMarker: false
66+
dendronVersion: 0.63.0

dendron.yml

+55-21
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,15 @@
1-
maxPreviewsCached: 10
2-
vaults:
3-
-
4-
fsPath: vault
5-
name: dendron.dendron-docs
61
useFMTitle: true
72
useNoteTitleForLink: true
8-
noAutoCreateOnDefinition: true
93
noLegacyNoteRef: true
10-
noXVaultWikiLink: true
114
mermaid: true
125
useKatex: true
13-
autoFoldFrontmatter: true
146
usePrettyRefs: true
157
dev:
168
enablePreviewV2: true
17-
journal:
18-
dailyDomain: daily
19-
name: journal
20-
dateFormat: y.MM.dd
21-
addBehavior: childOfDomain
22-
firstDayOfWeek: 1
23-
scratch:
24-
name: scratch
25-
dateFormat: y.MM.dd.HHmmss
26-
addBehavior: asOwnDomain
279
site:
2810
copyAssets: true
2911
siteHierarchies:
12+
- home
3013
- pkg
3114
siteRootDir: docs
3215
gh_edit_repository: 'https://github.com/dendronhq/dendron-docs'
@@ -46,15 +29,15 @@ site:
4629
action: useVault
4730
payload:
4831
- vault
49-
version: 2
50-
initializeRemoteVaults: true
32+
version: 4
5133
useTitleForLink: true
5234
commands:
5335
lookup:
5436
note:
5537
selectionMode: extract
5638
confirmVaultOnCreate: false
5739
leaveTrace: false
40+
bubbleUpCreateNew: true
5841
randomNote: {}
5942
insertNote:
6043
initialValue: templates
@@ -63,4 +46,55 @@ commands:
6346
enableMultiSelect: false
6447
insertNoteIndex:
6548
enableMarker: false
66-
dendronVersion: 0.63.0
49+
workspace:
50+
dendronVersion: 0.69.3-alpha.1
51+
vaults:
52+
-
53+
fsPath: vault
54+
name: dendron.dendron-docs
55+
journal:
56+
dailyDomain: daily
57+
name: journal
58+
dateFormat: y.MM.dd
59+
addBehavior: childOfDomain
60+
scratch:
61+
name: scratch
62+
dateFormat: y.MM.dd.HHmmss
63+
addBehavior: asOwnDomain
64+
graph:
65+
zoomSpeed: 1
66+
enableAutoCreateOnDefinition: false
67+
enableXVaultWikiLink: false
68+
enableRemoteVaultInit: true
69+
workspaceVaultSyncMode: noCommit
70+
enableAutoFoldFrontmatter: true
71+
maxPreviewsCached: 10
72+
maxNoteLength: 204800
73+
task:
74+
name: ''
75+
dateFormat: ''
76+
addBehavior: childOfCurrent
77+
statusSymbols:
78+
'': ' '
79+
wip: w
80+
done: x
81+
assigned: a
82+
moved: m
83+
blocked: b
84+
delegated: l
85+
dropped: d
86+
pending: 'y'
87+
prioritySymbols:
88+
H: high
89+
M: medium
90+
L: low
91+
todoIntegration: false
92+
createTaskSelectionType: selection2link
93+
enableUserTags: true
94+
enableHashTags: true
95+
preview:
96+
enableFMTitle: true
97+
enableNoteTitleForLink: true
98+
enableMermaid: true
99+
enablePrettyRefs: true
100+
enableKatex: true

vault/home.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
id: 3mlatcS5gb9FCyKGHyBzR
3+
title: Home
4+
desc: ''
5+
updated: 1637603141588
6+
created: 1637603013749
7+
---
8+
9+
Welcome to the Dendron Developer Docs
10+
11+
This contains all packages used in [Dendron](https://github.com/dendronhq/dendron).
12+
13+
All packages are organized using the following schema:
14+
15+
![[pkg.map#schema,1:#*]]

vault/pkg.common-all.cook.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ VaultUtils.getVaultByName({
1515
vaults,
1616
vname,
1717
})
18-
```
18+
```

vault/pkg.common-all.dev.cook.md

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
id: 1jIkH5R6W3pM8IYR2gOji
3+
title: Cookbook
4+
desc: ''
5+
updated: 1637185314831
6+
created: 1634737110155
7+
---
8+
9+
## Configuration
10+
11+
### Add New Config
12+
> Configuration is currently under active migration and the information here will be revised once the configs have been fully migrated.
13+
> As of this writing, we are on v3, where _commands_ and _workspace_ related configurations are migrated.
14+
15+
Dendron configuration in `dendron.yml` is defined in the following places:
16+
- new style configuration defined [here](https://github.com/dendronhq/dendron/blob/master/packages/common-all/src/types/configs/dendronConfig.ts)
17+
- legacy style configuration defined [here](https://github.com/dendronhq/dendron/blob/master/packages/common-all/src/types/workspace.ts).
18+
19+
During config migration, these two types are used to compose an [IntermediateDendronConfig](https://github.com/dendronhq/dendron/blob/6a7be61db3ec7e6fab61871b30ec215c47f1cb59/packages/common-all/src/types/intermediateConfigs.ts#L28), which has both old and new config keys.
20+
21+
***
22+
23+
When introducing a new config key, consider these points below:
24+
25+
1. What namespace does this new config belong? Is the namespace migrated yet?
26+
- If the namespace is already migrated,
27+
- Add the new config to an appropriate namespace of the new `DendronConfig`.
28+
- If the namespace is not yet migrated,
29+
- Add the config to the top level of the old `DendronConfig`
30+
- These will later be migrated when the namespace is migrated.
31+
- Follow the config conventions descirbed below as if you are adding to the new namespace to simplify the migration process.
32+
1. How should I name the config? Should it be optional or required?
33+
- For the sake of consistency, please consult the [[configuration conventions|dendron.dev.style.config]] note.
34+
1. When adding a config key to the new namespace type(s), you also have to add a corresponding entry in the [DendronConfigEntryCollection](https://github.com/dendronhq/dendron/blob/6a7be61db3ec7e6fab61871b30ec215c47f1cb59/packages/common-all/src/constants/configs/dendronConfig.ts#L10)
35+
- This is an object that holds every possible config key's label and description that will later be used to automatically generate a configuration view.
36+
- If this step is omitted, Typescript will complain that `DendronConfigEntryCollection` is missing a key.
37+
1. As per the [[configuration conventions|dendron.dev.style.config]], consider adding a sensible default of the newly introduced config key in the appropriate `genDefault{namespace}Config` method.
38+
- Each namespace is divided into separate modules [here](https://github.com/dendronhq/dendron/tree/master/packages/common-all/src/types/configs), and the namespace type and default generating methods live in the same module.
39+
- These default generating methods will be used by the `ConfigUtils` that are used to get and set configs later, so it is important to define a default here to simplify the process down the line.
40+
1. You will notice that when introducing a new config that is required and has a default value, `Extension.test.ts` will fail. Some test in `engine-test-utils` may fail as well since the snapshot should be updated.
41+
- Update the failing test in `Extension.test.ts`
42+
- Update the snapshot by running `yarn run test:updateSnapshot`
43+
1. Any time the config is changed, our the JSON schema that is validationg `dendron.yml` should be updated.
44+
- Run `yarn gen:data` at the root of the monorepo
45+
46+
### Accessing config values from `dendron.yml`
47+
48+
`ConfigUtils` is a collection of helpers that let you get or set config values from `dendron.yml`.
49+
Prefer using the getters and setters defined here over directly accessing from the config object.
50+
51+
e.g.)
52+
53+
```js
54+
const config = engine.config;
55+
// bad
56+
const noteLookupConfig = config.commands.lookup.note;
57+
// good
58+
const noteLookupConfig = ConfigUtils.getLookup(config).note;
59+
60+
...
61+
// bad
62+
config.commands.lookup.note = someProcessedNoteConfig;
63+
// good
64+
ConfigUtils.setNoteLookupProps(config, "confirmVaultOnCreate", true);
65+
```
66+
67+
The advantage over directly accessing
68+
- All helpers defined in `ConfigUtils` recursively account for missing values and replace them with the default values defined for the key you are accessing / modifying.
69+
```js
70+
static getProp<K extends keyof StrictConfigV3>(
71+
config: IntermediateDendronConfig,
72+
key: K
73+
): StrictConfigV3[K] {
74+
const defaultConfig = ConfigUtils.genDefaultConfig();
75+
const configWithDefaults = _.defaultsDeep(config, defaultConfig);
76+
return configWithDefaults[key];
77+
}
78+
```
79+
- It will also narrow down the types for you.
80+
- This is especially important during active config migration because we can avoid unnecessary type assertions.
81+
82+
Some commonly used getters and setters are defined in `ConfigUtils`. Use the best of your knowledge to use existing helpers or define a new one in a similar fashion if it doesn't exist.
83+
84+
## NoteProps
85+
86+
- try having plain objects on the note props
87+
88+
### Adding a new frontmatter property
89+
90+
In VSCode, you can use the "Goto symbol in workspace" command and type the function name or class name to find the following locations.
91+
92+
1. In `DNodeProps`, add the prop to the type. Unless the prop has to be mandatory for all notes, it should be optional (`prop?: type`). Most props don't have to be mandatory!
93+
2. In `DNodeUtils.create` add prop name to `optionalProps`.
94+
3. In `NoteUtils.serializeMeta` add prop name to `builtinProps`.
95+
4. In `DNodeUtils.getCustomProps` add prop name to `blacklist`.
96+
5. In `SchemaUtils.TEMPLATE_COPY_PROPS` add prop name if the prop should be copied over when a template note is used.
97+
6. **If and only if** it's a prop that's required (mandatory) for all notes, in `foundation.ts` add prop name to `REQUIRED_DNODEPROPS`. Again, most props don't have to be mandatory.

vault/pkg.common-all.dev.md

+3-40
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ id: 3c80629b-4048-48f0-bdfd-352645bda2ec
33
title: Dev
44
desc: |
55
Development related
6-
updated: 1633299662588
6+
updated: 1634740821907
77
created: 1622079130106
88
---
99
## Gotchas
@@ -12,41 +12,9 @@ Do not use any libraries in `common-all` that cannot run in the browser. It is u
1212

1313
For server based modules, put them into [[Common Server|pkg.common-server]] instead
1414

15-
## NoteProps
1615

17-
- try having plain objects on the note props
1816

19-
### Adding a new frontmatter property
20-
21-
In VSCode, you can use the "Goto symbol in workspace" command and type the function name or class name to find the following locations.
22-
23-
1. In `DNodeProps`, add the prop to the type. Unless the prop has to be mandatory for all notes, it should be optional (`prop?: type`). Most props don't have to be mandatory!
24-
2. In `DNodeUtils.create` add prop name to `optionalProps`.
25-
3. In `NoteUtils.serializeMeta` add prop name to `builtinProps`.
26-
4. In `DNodeUtils.getCustomProps` add prop name to `blacklist`.
27-
5. In `SchemaUtils.TEMPLATE_COPY_PROPS` add prop name if the prop should be copied over when a template note is used.
28-
6. **If and only if** it's a prop that's required (mandatory) for all notes, in `foundation.ts` add prop name to `REQUIRED_DNODEPROPS`. Again, most props don't have to be mandatory.
29-
30-
## Configuration
31-
32-
### Add New Property
33-
34-
Dendron configuration is managed by [DendronConfig](https://github.com/dendronhq/dendron/blob/master/packages/common-all/src/types/workspace.ts).
35-
36-
Whenever you add a new entry with a default, make sure to do the following as well.
37-
38-
- [[Tests for Configuration|dendron://dendron.dendron-site/pkg.common-all.dev#tests-for-configuration]]
39-
- [ ] document it under [[dendron config|dendron.topic.config.dendron]]
40-
41-
Before you submit, make sure to run the following at the root of the dendron repo
42-
43-
```sh
44-
yarn gen:data
45-
```
46-
47-
This will update the json schema definitions for `DendronConfig` which is used downstream by other packages
48-
49-
- [example issue](https://github.com/dendronhq/dendron/issues/613)
17+
<!-- ## Configuration
5018
5119
### Add New Default
5220
@@ -82,9 +50,4 @@ Configuration migrations should be done in two phases
8250
This uses dendron.yml for config instead of .code-workspace
8351
8452
- see commit 68556bf2
85-
- [fix: Use new config when creating special notes by hikchoi · Pull Request #984 · dendronhq/dendron](https://github.com/dendronhq/dendron/pull/984)
86-
87-
### Common
88-
89-
#### Tests for Configuration
90-
- if defaults are changed, `Extension.test.ts` needs to be updated to reflect this
53+
- [fix: Use new config when creating special notes by hikchoi · Pull Request #984 · dendronhq/dendron](https://github.com/dendronhq/dendron/pull/984) -->

0 commit comments

Comments
 (0)