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.

I made this so that updating my logseq graph's TODOs about a given repository would update the README.md of said repository.

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
    • 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 --must_match_regex "TODO|DONE" --bulletpoint-max-level 2 input.md output.md

# Full options
MdXLogseqTODOSync \
    --input-delim-start "- BEGIN_TODO" \
    --input-delim-end "- END_TODO" \
    --output-delim-start "<!-- BEGIN_TODO -->" \
    --output-delim-end "<!-- END_TODO -->" \
    --must_match_regex "TODO|DONE" \
    --bulletpoint-max-level 2 \
    --sub-pattern '(\s*)- (TODO|DONE|DOING|NOW|LATER) ' '\\1- ' \
    --remove-block-properties \
    --keep-new-lines \
    --recursive \
    input.md output.md

Configuration Options

  • input_file: Path or string pointing to the input Markdown/Logseq file
  • output_file: Path or string pointing to the output Markdown/Logseq file
  • input_delim_start: Regex pattern to match the start of input section. Use "START" for beginning of file. Default: "- BEGIN_TODO"
  • input_delim_end: Regex pattern to match the end of input section. Use "END" for end of file. Default: "- END_TODO"
  • output_delim_start: Regex pattern to match the start of output section. Default: "<!-- BEGIN_TODO -->"
  • output_delim_end: Regex pattern to match the end of output section. Default: "<!-- END_TODO -->"
  • bulletpoint_max_level: Maximum level of bullet points to process. Use -1 for unlimited. Default: -1
  • must_match_regex: Regex pattern that lines must match to be included. Default: r"^\s*- (TODO|DONE|DOING|NOW|LATER|#+) "
  • sub_pattern: Optional tuple of (search pattern, replace pattern) to modify matched lines. Default: (r"^(\s*)- (TODO|DONE|DOING|NOW|LATER) ", r"\1- ")
  • remove_block_properties: If True, removes Logseq block properties. Default: True
  • keep_new_lines: If True, preserves newlines from Logseq. Default: True
  • recursive: If True, processes nested TODO items under a matching parent. 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.15.tar.gz (19.2 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.15-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mdxlogseqtodosync-0.0.15.tar.gz
  • Upload date:
  • Size: 19.2 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.15.tar.gz
Algorithm Hash digest
SHA256 bc476f342a9b5cf50582f19b5a5a56e558b4149c77e2edccc17458c67dc2751d
MD5 ee15908b7a92f4647f04cc3d5d4d9c1a
BLAKE2b-256 fa67968a8f526b2847db3e5ec22756d158128e428ff15d032d78e67f8094bbd5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for MdXLogseqTODOSync-0.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 d8a0f156342b5d530bec1fd77a688df8dfccb9eef991123ddd3e35b797653f34
MD5 c20a6b27e527b539ebecbeae66d3a959
BLAKE2b-256 f5121a1e67b3e1e251eff64280d97ebec8a9167e1dd713762b2301513f099332

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