Git Product home page Git Product logo

obsidian-to-hugo's Introduction


Obsidian Vault to Hugo Content

Lightweight, zero-dependency CLI written in Python to help us publish obsidian notes with hugo.

It only takes two arguments: The obsidian vault directory (--obsidian-vault-dir) and the hugo content directory (--hugo-content-dir).

python -m obsidian_to_hugo --obsidian-vault-dir=<path> --hugo-content-dir=<path>

It takes care of the following steps:

  • Clears hugo content directory (directory will be deleted and recreated)
  • Copies obsidian vault contents into hugo content directory (.obsidian gets removed immediately after copying)
  • Replaces obsidian wiki links ([[wikilink]]) with hugo shortcode links ([wikilink]({{< ref "wikilink" >}}))

Replacement examples

Obsidian Hugo
[[/some/wiki/link]] [/some/wiki/link]({{< ref "/some/wiki/link" >}})
[[/some/wiki/link|Some text]] [Some text]({{< ref "/some/wiki/link" >}})
[[/some/wiki/link/_index]] [/some/wiki/link/]({{< ref "/some/wiki/link/" >}})

NOTE: For now, there is no way to escape obsidian wiki links. Every link will be replaced with a hugo link. The only way to get around this is changing the wiki link to don't match the exact sytax, for example by adding an invisible space (Obsidian will highlight the invisible character as a red dot). However, this still is really really not best practice, so if anyone wants to implement real escaping, please do so.

Installation

pip install obsidian-to-hugo

Usage

usage: __main__.py [-h] [--hugo-content-dir HUGO_CONTENT_DIR] [--obsidian-vault-dir OBSIDIAN_VAULT_DIR]

options:
  -h, --help            show this help message and exit
  --hugo-content-dir HUGO_CONTENT_DIR
                        Directory of your Hugo content directory, the obsidian notes should be processed into.
  --obsidian-vault-dir OBSIDIAN_VAULT_DIR
                        Directory of the Obsidian vault, the notes should be processed from.

obsidian-to-hugo's People

Contributors

devidw avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.