Skip to content

Tools to automatically sync an Obsidian vault to a git remote and convert links between wikilink and markdown link formats

Notifications You must be signed in to change notification settings

nwillems94/obsidian_tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

obsidian_tools

Tool to:

  1. Sync an Obsidian vault to a git remote
  2. Convert links from wiki-link to markdown link formats
  3. Convert math to GitHub/GitLab flavor markdown
  4. Automate the above

The tools are split between two files:

  • convert_to_giltab.py: a python script which converts math into GitHub/GitLab flavor markdown math notation and converts wikilinks into markdown links. When this code was first written, only GitLab supported mermaid diagrams, now GitHub does too. Feel free to use whichever service you want.
  • auto_convertcommit .bat/.sh: a batch/bash script which automatically commits file changes and creates a temporary directory for convert_to_giltab.py to process changes

Software

The tools depend on two pieces of software:

  • git
  • Python (os, re, sys modules)

Configuration

  • Copy the files convert_to_gitlab.py and auto_convertcommit.* into your Obsidian folder
  • convert_to_gitlab.py assumes all attachments (e.g., images) are in a folder called Attachments. If your folder is named differently, edit line 11 in convert_to_gitlab.py.

Git

  • Create a git instance in your Obisidian folder: git init. The files as they appear in Obsidian are your master branch.
  • Create a new branch called mdlinks: git branch mdlinks.
  • Add a remote called origin linking to your GitHub or GitLab remote.

Execute the batch script. You should now see two branches populated on your remote. You should be able to navigate mdlinks branch online including following links between files.

You can either execute this script whenever you want to sync new changes, or, alternatively, see below for automating the process.

Automation

On Windows, Task Scheduler can be configured to automatically run this script periodically to keep you work backed up. The below images are an example configuration.

general triggers actions settings

Please submit a pull request if you can provide instructions on automating this on Linux or MacOS.

About

Tools to automatically sync an Obsidian vault to a git remote and convert links between wikilink and markdown link formats

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published