Skip to main content

A quick way to convert obsidian markdown docs to markdown static pages

Project description

ObsiDown

Convert obsidian files into well linked markdowns!

Example use cases

  • Export Obsidian subdirectories while maintaining the links in markdown format
  • Make obsidian math Kramdown-compatible
  • Use obsidian to write for Jekyll web pages.

How to use

Define a configuration file config.yaml. In the repo it is provided one as example. Install the poetry dependencies and then you just need to run poetry run python -m obsidown --config path/to/config.yaml

It's possible to install from pypi index by pip install obsidown. Then you can run it with python -m obsidown

Feedback

This project is a hobby project used to automate some things I use myself. Currently it is a early early project! If you need additional features or report some issues or need help, feel free to open a new issue.

Documentation

The quickest way to check what is the format of the config file is to see the pydantic from config.py. Here I will just outline it briefly.

  • sources defines where to look for the input files.
    • paths: where to look for the md files?
    • images: where to look for the linked images?
  • output defines where to write the exported files.
    • base: defines the base url for links
    • path: defines a subpath for the markdown files
    • images: defines a subpath for the image fiiles
    • filesystem: where to write
  • pipeline: defines the single operations possible on a markdown file.
    • name: the identifier of the operation, you should check dispatch.py for a list of the operations.
    • options: variable options of the single operation.

Configuration Reference

Below is a more complete configuration example that you can adapt to your vault:

sources:
  paths:
    - /path/to/obsidian/notes
  images:
    - /path/to/obsidian/assets
output:
  base: notes
  path: content/notes
  images: images/notes
  images_path: static/images/notes
  filesystem: /var/www/my-site
pipeline:
  - name: remove_after_string
    options:
      string: "# Private Section"
  - name: remove_single_char_lines
    options:
      character: "-"
  - name: update_frontmatter
    options:
      frontmatter:
        ShowToc: true
        TocOpen: false
  - name: link_convert
    options: {}
  - name: write_file
    options: {}

Some useful pipeline operations and their options:

  • remove_after_string: drop content after the first occurrence of string. Set line: true to remove just the matching line portion.
  • remove_single_char_lines: remove lines entirely made of repetitions of a single character (for example Obsidian separators like -----).
  • update_frontmatter: merge or override metadata by passing a frontmatter dictionary.
  • citation_convert: convert citations with bibfile pointing to a Zotero/BibTeX export.
  • link_convert: translate Obsidian [[wikilinks]] into absolute links according to output.base.
  • write_file: persisting step that writes the transformed file in the configured destination.

You can chain as many operations as you need; each one receives the output of the previous step, so ordering matters.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

obsidown-0.2.9.tar.gz (25.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

obsidown-0.2.9-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

Details for the file obsidown-0.2.9.tar.gz.

File metadata

  • Download URL: obsidown-0.2.9.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for obsidown-0.2.9.tar.gz
Algorithm Hash digest
SHA256 45d495154cc80a8dd55df85777b6333c7557742bbdb3d5928b0f363f9bff6d0c
MD5 404108ae976d2d359c3dfebccf4af195
BLAKE2b-256 39b3f20d1b40172fcaec40c801891421cbd87e3c6726fcef918cd515080ddbbb

See more details on using hashes here.

File details

Details for the file obsidown-0.2.9-py3-none-any.whl.

File metadata

  • Download URL: obsidown-0.2.9-py3-none-any.whl
  • Upload date:
  • Size: 28.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for obsidown-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 0d3c7f2f84d05e0b45d64638031cd07ed2099efa909368953fc5c61f7a103451
MD5 6ced3a397434060c184720714284a1bd
BLAKE2b-256 cb4a77ddfe26ac53c27bc4f3524525a640200ca65129c96be2d78fb75808005e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page