Doctor CLI

Summary

Fix your notes using doctor

Usage

NOTE: the fixFrontmatter option is only available via the plugin at this time

doctor helps you fix your notes

Options:
  --version         Show version number                                [boolean]
  --help            Show help                                          [boolean]
  --wsRoot          location of workspace
  --vault           name of vault
  --quiet           don't print output to stdout
  --enginePort      If set, connect to to running engine. If not set, create new
                    instance of Dendron Engine
  --attach          Use existing engine instead of spawning a new one
  --useLocalEngine  If set, use in memory engine instead of connecting to a
                    server                                             [boolean]
  --action          what action the doctor should take
      [string] [choices: "fixFrontmatter", "h1ToTitle", "h1ToH2", "removeStubs",
              "createMissingLinkedNotes", "regenerateNoteId", "findBrokenLinks",
           "fixRemoteVaults", "fixAirtableMetadata", "addMissingDefaultConfigs",
                    "removeDeprecatedConfigs", "fixSelfContainedVaultsInConfig"]
  --query           run doctor over a query                             [string]
  --limit           limit num changes                                   [number]
  --dryRun          dry run                                            [boolean]
  --podId           podId used to export note(s) to Airtable            [string]

Options

--action

What action should the doctor take to mend the notes.

Values:

  • h1ToTitle:

    • Remove initial h1 header and use it to replace contents of title field in frontmatter

  • h1ToH2:

    • Convert all initial h1 header to h2 header

  • removeStubs:

    • Remove all stub docs

  • createMissingLinkedNotes:

    • Create notes that do not exist yet but has a wikilink to it.
    • A preview pane will appear with the notes that will be created before proceeding.
    • In a multi-vault workspace, wikilinks that do not specify a vault prefix will be omitted from the candidates.
      • In a workspace that has 2 vaults named foo and bar, the wikilink [[missing-note]] will not be a candidate for missing note creation with this command.
      • However, [[dendron://foo/missing-note]] and / or [[dendron://bar/missing-note]] will be recognized as a missing note and will be listed as candidates.

  • regenerateNoteId:

    Regenerates the IDs of your notes.

    • Command: Dendron: Doctor
    • Option: regenerateNoteId

    If you publish your notes, this will break the published links to your notes.

    To change the scope of using this command (single note vs. workspace), remember to follow the notice in Dendron Doctor Details.

  • findBrokenLinks:

    Similar to createMissingLinkedNotes: find all broken links (that have a vault prefix). This does note create new notes.

    • Command: Dendron: Doctor
    • Option: findBrokenLinks

    This simply lists all broken links in the scope.

  • fixRemoteVaults:

    If you have a remote vault that is not correctly marked as such in the configuration, this action will fix your config file for you.

    • Command: Dendron: Doctor
    • Option: fixRemoteVaults

  • fixAirtableMetadata:

    Update airtable export pod metadata to latest version. Before running this command, Navigate to the domain of the hiearchy (eg. tasks) that is currently exported When run, the doctor will ask for the following:

    • hierarchy to export (same hierarchy you are currently on)
    • pod id that this hierarchy is exported to (select the relevant pod config)

    After doctor has run, it will convert all scalar airtable destinations to the new value

  • addMissingDefaultConfigs:

    • Detects if there are any missing configurations that are required or has a default value in dendron.yml.

    • When a missing configuration exists, a backup of dendron.yml is created and the missing keys are added with their corresponding default values.

    • Command: Dendron: Doctor

    • Option: addMissingDefaultConfigs

  • removeDeprecatedConfigs:

    • Detects if there are any deprecated configurations that are still in dendron.yml.

    • When a deprecated configuration key exists, a backup of dendron.yml is created and the deprecated keys are removed.

    • Command: Dendron: Doctor

    • Option: removeDeprecatedConfigs

  • fixSelfContainedVaultsInConfig: Fixes issues in the dendron.yml when using/moving to a self-contained vault

Examples

  • convert all h1 tags to frontmatter title values for the readings hierarchy
dendron doctor --wsRoot . --action h1ToTitle --limit 10 --query "readings.*" 
  • see log
LOG_LEVEL=info LOG_DST=stdout dendron doctor --wsRoot . --action h1ToTitle --limit 10 

Backlinks