Tutorial

Dendron Important Files

  • dendron.yml (Private) - Customization of Dendron behavior.
  • dendron.code-workspace (Private) - Essentially VsCode workspace settings. Includes task, debugger settings, etc.
    • For some reason going to file on code-workspace doesn't work, but you can alt+click to open. This is the only file I now of that won't open with the wiki link.
  • dendronrc.yml (Private) - Allows you arbitrarily link to notes from other workspaces.
  • Check Extensions to get an idea of extensions used.

Dendron Cli

  • 🚨 NOT WORKING

    • I need to rewrite some of the bash scripts, once these are written, latex-writing-environment will make more sense.
      • This is an example of linking within a note
      • Note that regular markdown linking should be used for linking within document. command paletteTrigger Suggest is useful for this.
  • This step is necessary for stitching together Paper.

  • Initialize a npm repo at the root of your workspace (where dendron.yml is located)

    • npm init -y
  • Install dendron-cli

    • npm install @dendronhq/dendron-cli@latest

Markdown Linting

"markdownlint.config":{
            "MD007": { "indent": 2 },
            "MD008": false,
            "MD013": false,
            "MD014": false,
            "MD018": false,
            "MD025": false,
            "MD026": false,
            "MD033": false,
            "MD045": false,
            "MD050": false,
        },
  • These codes can be hovered over or searched to find their specification. For example "MD007" specifies the unordered list indentation.
  • It is preferred to keep formatting up to snuff, by formatting on save. The following setting is used to format on save.
"editor.codeActionsOnSave": {
      "source.fixAll.markdownlint": true,
   },

  • To test linting is working edit the README (Private) like so, see the red squiggles, and save the document to see the reformatting.

  • Before

  • After

Python Package

  • This repo is setup for some basic python development. The preferred way to develop is to write an editable package with the intention of eventually publishing to PyPI.

Run __main__.py from Debugger

Error Python Package

Exception has occurred: ModuleNotFoundError
No module named 'my_package'
  File "/Users/michaelvolk/Documents/projects/Dendron-Template/src/my_package/__main__.py", line 1, in <module>
    from my_package import first_module
ModuleNotFoundError: No module named 'my_package'

VsCode Tasks

  • Interactive Tasks: nano Interactive and nano qsub main.
    • These are intended to show the interactive options of tasks. But they will run as they are. The two examples were used for working with the Nano Cluster.
  • Pandoc: quick-pdf does a quick print of a Dendron note. We will walk through its usage.

Pandoc: quick-pdf

  • Install Pandoc, the swiss army knife 🇨🇭🪖🔪 document conversion.
    • Pandoc is how Paper in ultimately written to a pdf, docx, latex, etc.
  • Open note Extensions, and run Pandoc: quick-pdf.
    • This command works by referencing the current focused file.
  • A terminal output will open.
 Executing task in folder Dendron-Template: cd ./notes && pandoc -F mermaid-filter -s /Users/michaelvolk/Documents/projects/Dendron-Template/notes/vscode.extensions.md -o /Users/michaelvolk/Documents/projects/Dendron-Template/notes/assets/pdf-output/vscode.extensions.pdf --pdf-engine=xelatex -V geometry:'top=2cm, bottom=1.5cm, left=2cm, right=2cm' --strip-comments  && cd ..

Latex Writing Environment

Potential of Combining Dendron Notes to Latex Paper

  • Notes can converted to individual latex documents based on some tex template.
    • 🚨 I haven't done this.
pandoc input.md -o output.tex -s --template=mytemplate.tex
  • This can be done in one shot Paper to paper.tex, or it can be done piecewise by using the import capabilities within latex. For example we could do Introduction to sections/introduction.tex, which would then be stitched together in main.tex. Below I show a sample hierarchy from a previous overleaf project.

  • Naysayer 😈: "Pointless! Why not just write all notes in Latex? This is redundant."

  • Evangelist 😇: "Notes in Dendron allows for searchability, hierarchical notes, and linking of disparate ideas. It's the power of connection! Latex is about the final product 💎."

  • If we really wanted we could even write a task, say paper to latex paper, that will write all of the necessary latex files for building main.tex from Dendron markdown notes. This task would just call a bash script or python script that does this conversion, calling necessary pandoc tools, etc.

Jupyter Notebooks

Reproducible Python Environments

  • For reproducible python environments, we write the requirements to a env.yml. It is worth seeing that the following commands can reproduce the environment.

Exporting Environment YAML

conda env export --no-builds | grep -v "prefix" | grep -v "$(pip freeze | grep 'my-package==')\|$(pip freeze | grep 'another-package==')" > env/env-dendron-template.yml
  • I cannot take credit for the command line wizardry 🧙🏼‍♂️ Conversation.

Conda Create from YAML and Install Package

conda env create -f env/env-dendron-template.yml python=3.11
conda activate env-dendron-template
python -m pip install -e .

Drawio

  • Not necessary but another element I like about taking notes with Dendron is using the Draw.io extension. This allows making quick graphics that can be updated at any time.

Drawio Demonstrations

  • To make a draw.io image command paletteDraw.io: New Draw.io Diagram.
  • Make a drawing and save the file.
  • Within the draw.io gui go to file → convert → png or svg.
  • Import the image as you would import any other image. See below.
  • If the image is too small once imported into a note you can adjust the size by changing the zoom property. Go to the draw.io gui go to file → properties → zoom.

  • This draw.io graphic shows how the dendronrc.yml (Private) is used, and how the workspace is intended to be used in a modular fashion. The important part of this linking is that each workspace is standalone. If an of the links are severed by removing the workspace from the dendronrc.yml (Private), links and note references will go dead, but this should not cause any other part of the workspace to break. The links can be restored by adding the workspace back to dendronrc.yml (Private), and links are traceable if enableXVaultWikiLink: true in dendron.yml (Private) . This is the default.

  • This is an example of how draw.io using latex equations. There is another feature that I haven't found terribly useful, but it is interesting. You can link draw.io objects to individual code files. This can be done by selecting a draw.io object, opening a code file, and funning Draw.io: Toggle Code Link Activation. Then if you open the draw.io image, you can double click that object and it should open the file. This could be useful for charting out different modules and planing. Draw.io also allows for input of data, so graphs can be constructed by data import. There is some interesting ideas here around visualizing code dependencies, note linkages of subgraphs within Dendron, etc.

  • Most figures in this project are made with Draw.io.

Python Docs

  • Documentation could be written with Dendron, but there are already tools that have a lot of nice features for documenting a python library. I've elected to use Sphinx for documentation. A Sphinx Step-by-Step Guide will help with python documentation.

Python Testing

  • I have setup this project to use pytest for all python projec testing. Test files sit in tests/test_*.py and test the functionality of the library in src