Cookbook
Install a new package
Because Dendron is packaged as a mono repo managed using lerna, you can't just do a regular yarn add
to install new packages. This is because lerna symlinks mono-repo dependencies together and a yarn add
would override that. Instead, use the following command:
lerna add {package-to-install} --scope @dendronhq/{package-to-install-into}
Because this is typescript, don't forget to also install the @types
package if it exists
lerna add @types/{package-to-install} --scope @dendronhq/{package-to-install-into}
Add a new node package
- initialize repo
cd {workspace_dir}
cp -R /path/to/dendron-yeoman/node-ts packages/{new-package}
-
update
package.json
- change project name
-
publish the repo (needs to be done initially before running lerna publish)
npm publish --access public
Using eslint
All packages in the repo use a standard base configuration found at .eslintrc.js. If you're using the VS Code and would like to see eslint violations on it, install the eslint extension.
Add a new site config option
The following is an example of controlling formatting options to the DendronSiteConfig. You can see the issue for more details.
Dendron currently will auto-format notes during Rename
and Refactor
operations when links inside a note need to be replaced.
The formatting options are defined here.
These are rough notes of how formatting gets called during rename
To make this customizable, the following changes need to be made:
- update the DendronConfig type definition
- update config defaults
- pass in formatting options from the plugin
- accept formatting args in the server
- accept formatting args in the engine
- accept it when replacing links
- accept it in remark pipeline
When all this is done, we can add tests that the formatting behavior works
The above changes are for Rename
. Refactor
calls rename in a loop so changing rename should update refactor as well.