Skip to content

Repository files navigation

Logseq to Obsidian Converter

A Python script to convert your Logseq notes to Obsidian format, preserving your content while adapting to Obsidian's markdown syntax.

Features

  • Converts Logseq's block-based structure to Obsidian's markdown format
  • Handles block references, page references, and tags
  • Converts Logseq properties to Obsidian YAML frontmatter
  • Preserves code blocks and other markdown formatting
  • Copies assets (images, attachments) to the Obsidian vault
  • Properly handles empty bullet points
  • Provides detailed logging and statistics

Requirements

  • Python 3.6 or higher

Installation

  1. Clone this repository or download the script files
  2. No additional dependencies are required beyond the Python standard library

Usage

python logseq_to_obsidian.py --logseq-dir /path/to/logseq/graph --obsidian-dir /path/to/obsidian/vault

Command Line Arguments

  • --logseq-dir: Path to your Logseq graph directory (required)
  • --obsidian-dir: Path to your Obsidian vault directory (required)
  • --preserve-bullets: Keep bullet points in the conversion (default: convert to plain text)
  • --skip-block-refs: Skip conversion of block references
  • --skip-properties: Skip handling of properties
  • --skip-queries: Skip handling of queries
  • --skip-tags: Skip handling of tags
  • --verbose, -v: Enable verbose logging

Examples

Basic Conversion

python logseq_to_obsidian.py --logseq-dir ~/Documents/logseq/my-notes --obsidian-dir ~/Documents/obsidian/my-vault

Preserve Bullet Points

python logseq_to_obsidian.py --logseq-dir ~/Documents/logseq/my-notes --obsidian-dir ~/Documents/obsidian/my-vault --preserve-bullets

Skip Certain Conversions

python logseq_to_obsidian.py --logseq-dir ~/Documents/logseq/my-notes --obsidian-dir ~/Documents/obsidian/my-vault --skip-queries --skip-tags

Conversion Details

What Gets Converted

  1. Bullet Points: By default, Logseq's bullet points are converted to plain text. Use --preserve-bullets to keep them.
    • Empty bullet points (lines with just a dash -) are converted to blank lines.
  2. Block References: Logseq's ((block-id)) format is converted to Obsidian's [[block-id]] format.
  3. Page References: Logseq's [[page name]] is already compatible with Obsidian, but references with block IDs are adjusted.
  4. Properties: Logseq properties are converted to YAML frontmatter.
  5. Queries: Logseq queries are converted to HTML comments.
  6. Tags: Logseq's #[[tag name]] format is converted to Obsidian's #tag-name format.

Assets

The script copies all files from the Logseq assets directory to the Obsidian vault's assets directory, preserving the directory structure.

Limitations

  • The script does not handle Logseq's advanced features like custom queries or templates
  • Some manual adjustments may be needed for complex notes
  • The script does not migrate Logseq plugins or settings

Troubleshooting

If you encounter issues, check the log file logseq_to_obsidian_conversion.log for details. Use the --verbose flag for more detailed logging.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A simple python script to convert all your logseq files to Obsidian

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages