Skip to main content

Script to always sync a Logseq TODO list with a markdown file

Project description

MdXLogseqTODOSync

A Python tool to synchronize TODO items between Markdown and Logseq files. It allows you to maintain TODO lists across different markdown formats while respecting delimiters and filtering based on patterns and bullet point levels.

Features

  • Synchronize TODO items between different markdown files
  • Configurable delimiters to mark sync boundaries
  • Filter content based on regular expression patterns
  • Control maximum bullet point depth
  • Preserves formatting and indentation
  • Type-safe implementation with beartype

Getting started

  • From pypi:
    • As a tool: uvx MdXLogseqTODOSync@latest --help # TODO: can this be used as a tool?
    • Via uv: uv pip install MdXLogseqTODOSync
    • Via pip: pip install MdXLogseqTODOSync
  • From github:
  • Clone this repo then pip install .

Usage

The tool is primarily used from the command line:

mdxlogseqtodosync --help

# Basic usage
mdxlogseqtodosync input.md output.md

# With filtering options
mdxlogseqtodosync --pattern "TODO|DONE" --max-level 2 input.md output.md

# Full options
mdxlogseqtodosync \
    --input-start "- BEGIN_TODO" \
    --input-end "- END_TODO" \
    --output-start "<!-- BEGIN_TODO -->" \
    --output-end "<!-- END_TODO -->" \
    --pattern "TODO|DONE" \
    --max-level 2 \
    --remove-prefix false \
    --remove-block-properties true \
    --keep-new-lines true \
    --recursive true \
    input.md output.md

Configuration Options

  • input_file: Source markdown file path
  • output_file: Destination markdown file path
  • input_delim_start: Start delimiter pattern for input file (default: "- BEGIN_TODO")
  • input_delim_end: End delimiter pattern for input file (default: "- END_TODO")
  • output_delim_start: Start delimiter for output file (default: "<!-- BEGIN_TODO -->")
  • output_delim_end: End delimiter for output file (default: "<!-- END_TODO -->")
  • bulletpoint_max_level: Maximum bullet point level to process (-1 for unlimited)
  • required_pattern: Regex pattern that lines must match to be included. Default is r"\s*- (TODO|DONE)"
  • remove_prefix: Boolean to control whether TODO/DONE prefixes are removed from output (default: True)
  • remove_block_properties: Boolean to control whether Logseq block properties are removed (default: True)
  • keep_new_lines: Boolean to control whether empty lines are preserved (default: True)
  • recursive: Boolean to control whether nested TODOs under a matching parent are included (default: True)

File Format

Input file example:

Some content...

- BEGIN_TODO
- TODO Review pull request
  - DONE Update tests
  - TODO Add documentation
- END_TODO

More content...

Output file example:

# Project TODOs

<!-- BEGIN_TODO -->
- TODO Review pull request
  - DONE Update tests
  - TODO Add documentation
<!-- END_TODO -->

Error Handling

The tool includes robust error checking for:

  • Missing or duplicate delimiters
  • Non-existent input files
  • Empty or invalid content blocks
  • Invalid regex patterns

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

See LICENSE.md file for details.

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

mdxlogseqtodosync-0.0.10.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

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

MdXLogseqTODOSync-0.0.10-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file mdxlogseqtodosync-0.0.10.tar.gz.

File metadata

  • Download URL: mdxlogseqtodosync-0.0.10.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.20

File hashes

Hashes for mdxlogseqtodosync-0.0.10.tar.gz
Algorithm Hash digest
SHA256 24e4451d093670e8a9e2384a53c0b8750091a7e3ba4249d76e621a51e9826d38
MD5 9e1f2796f4ac56557285d185b4bf43d6
BLAKE2b-256 f55f50a2e21d0ecf4e460ca28cb7a4df4c9d874261df31e56096d1fa01560d0e

See more details on using hashes here.

File details

Details for the file MdXLogseqTODOSync-0.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for MdXLogseqTODOSync-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 4c87ba35f5841960b7cdbd8c219533a5c937e67d0c1db3539a057c8e0f2c3fb3
MD5 cad1ed56842b4e7d4b3e6c04bd722712
BLAKE2b-256 9be4e2407857b0705a241f535c010eb44abd2d9d247916d474748dfdab456d62

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