Metadata-Version: 2.1
Name: obsidian_to_hugo
Version: 0.2.0
Summary: Process Obsidian notes to publish them with Hugo. Transforms Obsidian wiki links into Hugo shortcodes for internal linking.
Author-email: David Wolf <d@wolf.gdn>
License: MIT
Project-URL: Source, https://github.com/devidw/obsidian-to-hugo
Project-URL: Bug Tracker, https://github.com/devidw/obsidian-to-hugo/issues
Keywords: obsidian,hugo,markdown,wikilink
Classifier: Typing :: Typed
Classifier: Environment :: Console
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Text Processing :: Markup
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

<h1 align=center>
<img src=https://raw.githubusercontent.com/devidw/obsidian-to-hugo/master/img/gopher-obsidian.png width=100 height=100>
<br>
Obsidian Vault to Hugo Content
</h1>

<p align="center">
<a href="https://obsidian-to-hugo.wolf.gdn" target="_blank">
<img src="https://raw.githubusercontent.com/devidw/obsidian-to-hugo/master/img/demo.gif">
</a>
</p>

Lightweight, zero-dependency CLI written in Python to help us publish [obsidian](https://obsidian.md) notes with [hugo](https://gohugo.io). 

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

```console
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
| -------- | --------
| ![](https://raw.githubusercontent.com/devidw/obsidian-to-hugo/master/img/obsidian.png) | ![](https://raw.githubusercontent.com/devidw/obsidian-to-hugo/master/img/hugo.png)
| `[[/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/" >}})`
| `[[/some/wiki/link#Some Heading\|Some Heading Link]]` | `[Some Heading Link]({{< ref "/some/wiki/link#some-heading" >}})`

> 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](https://en.wikipedia.org/wiki/Zero-width_space) (Obsidian will highlight the invisible character as a red dot).
> ![](https://raw.githubusercontent.com/devidw/obsidian-to-hugo/master/img/do-not-do-that.png)
> However, this still is really really *not* best
> practice, so if anyone wants to implement real escaping, [please do
> so](https://github.com/devidw/obsidian-to-hugo/pulls).


## Installation

```console
pip install obsidian-to-hugo
```


## Usage

```console
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.
```
