Skip to main content

A Python CLI tool for converting Leaflet to Zoommap.

Project description

Leaflet-to-Zoommap Converter

This repository contains a Python CLI tool to parse Obsidian Vaults and convert Leaflet codeblocks to Zoommap (TTRPG Tools: Maps) format, supporting map scales, icons and shapes.

Overview

ZoomMap Converter is designed to facilitate the migration from the Obsidian Leaflet plugin to the ZoomMap plugin. It handles the conversion of map notes, markers, and configurations while maintaining compatibility with Obsidian vault structures.

Features

  • Note Conversion: Converts Leaflet-formatted codeblocks to ZoomMap format.
  • Icon Processing: Transforms custom SVG icons with color and size normalisation over to Zoommap.
  • Error Handling: Validation and logging for troubleshooting.
  • Path Management: Handles Obsidian vault file paths and structures.

Installation

Prerequisites

  • Python 3.12+
  • Obsidian vault with Leaflet plugin notes
  • Leaflet Plug-In installed and enabled.
  • Zoommap Plug-In installed and enabled.

Setup

  1. Download the CLI tool using pip.
pip install zoommap-converter
  1. Once installed, you can test the install was successful using:
zoommap-converter --version

Usage

Pre-flight Checklist

Before running the converter, please ensure you have satisfied the Prerequisites.

In addition, you should ensure the following conditions are met:

  • If you wish to have your markers converted across to Zoommap, you should make sure you have the SVG icons downloaded and extracted/unzipped in the vault. They must be stored in the same location as defined in the TTRPG Tools: Maps settings (e.g. default folder is ZoomMap/SVGs). Without this, your markers will not be migrated across and the default pin will be used. Note: Custom Images/SVGs are not supported at this time. Settings to download SVGs

Basic Conversion

  1. Create and configure the settings.yaml file and ensure to include the vault_path and target_path:
vault_path: leaflet-vault
target_path: converted-leaflet-vault

Note: See the sample settings.yaml for more configuration options.

  1. Set the path to your settings.yaml via environment variables:
export SETTINGS=path/to/settings.yaml

zoommap-converter

Or pass it as an argument to the tool:

zoommap-converter --settings path/to/settings.yaml

Settings

Conversion settings are stored in YAML format. In this vault, we use settings.yaml. We pass this file to the converter process using the --settings flag, or by exporting the following environment variable:

export SETTINGS=/path/to/settings.yaml

CLI Arguments

The following table contains the list of CLI arguments that are used for the tool. Similar functionality can be used in the settings.yaml file.

Argument Description Default Value Type/Action
--settings Path to the settings file. $SETTINGS env var Path
--version Show the tool version and exit. - version
--no-backup Do not create a backup of the original vault before conversion. False store_true
-v, --verbose Increase output verbosity. False store_true
--in-place Convert the vault in-place (no duplicate created). False store_true
--merge-by-image Merge Zoommap markers.json files by images, rather than image + ids or image + marker_tags False store_true
--ignore-marker-tags Ignore merging by image + marker_tags, instead only merging by id. Note: this only affects the outputted Zoommap JSON file, notes with marker tags in the frontmatter will still be parsed for markers. False store_true
--log-level Set the logging level. Choices: DEBUG, INFO, WARNING, ERROR, CRITICAL. $LOG_LEVEL or INFO str (uppercase)

Development

Project Structure

├── src
│   └── zoommap_converter
│       ├── __init__.py
│       ├── __main__.py
│       ├── app.py
│       ├── cli.py          # Command-line interface
│       ├── logs.py
│       ├── bootstrap/      # Initialisation and setup
│       ├── conf/           # Settings Config
│       ├── converter/      # Core conversion logic
│       └── models/         # Data models and schemas
tests/

Developer Setup

  1. Clone the repository:

    git clone https://codeberg.org/paddyd/zoommap-converter.git
    cd zoommap-converter
    
  2. Install dependencies using uv:

    uv install
    
  3. Configure the vault path in settings.yaml or via environment variables

Running Tests

uv run pytest tests

Building

uv build

Contributing

Contributions are welcome. Please use the provided issue and pull request templates when contributing and follow these guidelines:

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request with clear documentation
  4. Include tests for new functionality

License

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

Roadmap

Current items on the roadmap:

  • Migrating Custom SVGs/Icons
  • Overlays

If you have any other features you'd like me to include, please write a Feature Request.

Support

For issues, questions or feature requests, please file an issue.

Acknowledgements

  • Jareika the creator of TTRPG Tools: Maps.
  • Obsidian community for plugin development
  • Font Awesome for icon assets
  • Pydantic for data validation

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

zoommap_converter-0.5.2a1.tar.gz (33.5 kB view details)

Uploaded Source

Built Distribution

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

zoommap_converter-0.5.2a1-py3-none-any.whl (39.7 kB view details)

Uploaded Python 3

File details

Details for the file zoommap_converter-0.5.2a1.tar.gz.

File metadata

  • Download URL: zoommap_converter-0.5.2a1.tar.gz
  • Upload date:
  • Size: 33.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for zoommap_converter-0.5.2a1.tar.gz
Algorithm Hash digest
SHA256 5bea9d7ae5b54a32ddf7f9c50dc934dc8afa385fd355cd09d6bb4af11ec1b87d
MD5 411baad95037cf84164ad0e5d56b1adf
BLAKE2b-256 c4cde57c5d8e4cf9fdbb26730685e38d63488349d0b6c434143da76a51dc4db5

See more details on using hashes here.

File details

Details for the file zoommap_converter-0.5.2a1-py3-none-any.whl.

File metadata

  • Download URL: zoommap_converter-0.5.2a1-py3-none-any.whl
  • Upload date:
  • Size: 39.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for zoommap_converter-0.5.2a1-py3-none-any.whl
Algorithm Hash digest
SHA256 bd4a742564d15ab972863a3049688afeba6b9ed49e27b092a2459d6ab2d9b7d5
MD5 2076a5641335b263b40ea5575eb8c27b
BLAKE2b-256 9fcefc4ce0d84a6b2b5575ea98f1385a8ea5d4ae4079d306eae2179f91c886e9

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