Fix Logseq Task List query block pattern #1

Merged
d_mcknight merged 11 commits from feat/logseq-query-cleanup-fix into main 2026-11-03 20:21:28 -08:00
Showing only changes of commit 8611b14092 - Show all commits

View file

@ -1,49 +1,77 @@
# Logseq Task List Query Cleaner # Logseq Task List Query Cleaner
A Python script to clean up Logseq journal pages by removing the auto-generated "Task List" query blocks. A suite of Python scripts to clean up and normalize Logseq journal pages.
## Problem ## Available Scripts
Logseq journal pages often contain two auto-generated query blocks at the bottom: ### 1. `clean_task_lists.py` - Remove Task List Query Blocks
1. **Work Task List** - Shows TODO/LATER items tagged with specific pages (e.g., `#neonai`) Removes auto-generated "Task List" query blocks that Logseq adds to journal pages.
2. **Personal Task List** - Shows TODO/LATER items not tagged with work pages
These query blocks add visual clutter when you want to review or archive daily notes.
## Solution
This script removes both Task List query blocks while preserving all your actual note content.
## Usage
### Basic Usage
```bash ```bash
python3 clean_task_lists.py --dry-run journals/
python3 clean_task_lists.py -r journals/
```
### 2. `clean_empty_bullets.py` - Remove Empty Bullet Lines
Removes empty bullet lines (lines with only whitespace and/or a single dash `-`).
```bash
python3 clean_empty_bullets.py --dry-run journals/
python3 clean_empty_bullets.py -r journals/
```
### 3. `ensure_newline_ending.py` - Normalize File Endings
Ensures all files end with exactly one newline character.
```bash
python3 ensure_newline_ending.py --dry-run journals/
python3 ensure_newline_ending.py -r journals/
```
### 4. `run_full_cleanup.sh` - Master Cleanup Script
Runs all cleanup scripts in the correct order:
1. Remove Task List query blocks (largest changes first)
2. Remove empty bullet lines (cleanup remnants)
3. Ensure single trailing newline (final normalization)
```bash
# Dry run
./run_full_cleanup.sh --dry-run ~/notes_test/journals/
# Process a single file # Process a single file
python3 clean_task_lists.py path/to/journal-page.md ./run_full_cleanup.sh ~/notes_test/journals/2026_10_23.md
# Process all .md files in a directory # Process recursively
python3 clean_task_lists.py path/to/journals/ ./run_full_cleanup.sh -r ~/notes_test/journals/
# Process recursively through subdirectories
python3 clean_task_lists.py -r path/to/journals/
``` ```
### Dry Run ## Usage Examples
### Quick Single File Cleanup
```bash ```bash
# See what would be changed without modifying files # Use the master script for complete cleanup
python3 clean_task_lists.py --dry-run path/to/journals/ ./run_full_cleanup.sh path/to/journal.md
``` ```
### Examples ### Batch Process All Journals
```bash ```bash
# Check a single file first # Preview first
python3 clean_task_lists.py --dry-run 2026-10-23.md ./run_full_cleanup.sh --dry-run -r journals/
# Clean a whole month of journals # Then execute
python3 clean_task_lists.py journals/2026/10/ ./run_full_cleanup.sh -r journals/
```
# Clean everything recursively ### Individual Script Usage
python3 clean_task_lists.py -r ~/logseq/journals/ ```bash
# Just remove query blocks
python3 clean_task_lists.py -r journals/
# Just fix empty bullets
python3 clean_empty_bullets.py -r journals/
# Just normalize endings
python3 ensure_newline_ending.py -r journals/
``` ```
## What Gets Removed ## What Gets Removed