Tool to:
- Sync an Obsidian vault to a git remote
- Convert links from wiki-link to markdown link formats
- Convert math to GitHub/GitLab flavor markdown
- 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
: abatch
/bash
script which automatically commits file changes and creates a temporary directory forconvert_to_giltab.py
to process changes
The tools depend on two pieces of software:
- git
- Python (os, re, sys modules)
- Copy the files
convert_to_gitlab.py
andauto_convertcommit.*
into your Obsidian folder convert_to_gitlab.py
assumes all attachments (e.g., images) are in a folder calledAttachments
. If your folder is named differently, edit line 11 inconvert_to_gitlab.py
.
- Create a git instance in your Obisidian folder:
git init
. The files as they appear in Obsidian are yourmaster
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.
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.
Please submit a pull request if you can provide instructions on automating this on Linux or MacOS.