Skip navigation

ObsiWiki

ObsiWiki

I really wanted to use Obsidian to write documentation for my home server, but publishing it directly to GitHub Wiki doesn't quite work because of odd discrepancies between Obsidian's markdown syntax and GitHub's. This is a Git hook system that automatically transforms Obsidian's unique link syntax into GitHub Wiki format. It's as simple as writing your notes in Obsidian and committing them; the script automatically converts text to the correct format and pushes changes to the wiki!

🛠️ Technologies Used:

Python Git Hooks Regular Expressions Bash/Shell Scripting Markdown GitHub Wiki Obsidian Subprocess

🔗 Links: GitHub Repository | Setup Guide

My Development Process

the logo for the Python programming language

Python's logo.

Key Features:

  • Automatic Link Conversion - Transforms Obsidian's `[[wikilink]]` syntax to GitHub Wiki format
  • Git Integration - Seamlessly integrates with existing Git workflows through hooks
  • Batch Processing - Efficiently handles multiple files and directory structures
  • Error Handling - Robust error handling for various edge cases and syntax variations
  • Bidirectional Sync - Future enhancement to sync changes from GitHub Wiki back to Obsidian

GitHub has an included "Wiki" feature, which lets each repository have its very own... wiki! I wanted to be able to write the pages using a note-taking application called Obsidian, but with GitHub's frankly odd proprietary flavor of Markdown, it was more complicated than just pushing the Markdown files. After a search that spanned way longer than it should have, I found, forked, and began developing this Python script! Using Git's post-commit hook, it converts notes written in Obsidian to a format that GitHub Wiki likes and uploads it automatically.It was a sort of arduous process, but well worth it. These are the steps I took:

Development Journey:

  1. Looking for an existing solution - I couldn't for the life of me find a community plugin or feature to handle this, until I came across a Reddit post by a professor from Portugal talking about his experiment script. I navigated to the GitHub repo, installed the Git hook, and it was kind of magical, seeing my home server wiki written in Obsidian appear online.

  2. Becoming a maintainer - I was a total newbie to GitHub. I made a couple pull requests to the repo, but nothing happened for a while. I ended up reaching out to Björn via email, and after a while, I was able to become a maintainer!

  3. Finalizing the Language - The original maintainer chose Python, and I can see why. It's got excellent string processing capabilities and extensive regex support. I ended up sticking with it.

  4. Writing the Core Algorithm - I ironed out the regex patterns and conversion logic to handle various markdown syntax differences. This was the most challenging part due to the complexity of edge cases. Regex has made me want to pull out my hair several times.

  5. Git Integration & Troubleshooting - Git can be finicky, so there were a lot of strange errors here 🥲.

  6. Finishing! - Except there's always more work to be done. There's a chance this page will be outdated by the time you're reading it (check the GitHub repo to see the current state o the project).