https://github.com/crypdick/obsidian-tools
Scripts to help manage my Obsidian 2nd brain
https://github.com/crypdick/obsidian-tools
Last synced: 11 months ago
JSON representation
Scripts to help manage my Obsidian 2nd brain
- Host: GitHub
- URL: https://github.com/crypdick/obsidian-tools
- Owner: crypdick
- License: apache-2.0
- Created: 2025-07-15T14:34:59.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-07-15T18:22:20.000Z (12 months ago)
- Last Synced: 2025-07-16T08:04:43.310Z (12 months ago)
- Language: Python
- Size: 26.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Obsidian Tools
Scripts to help manage my Obsidian 2nd brain
- `add_dataview_limits.py`: Recursively scans markdown files in an Obsidian vault and appends `LIMIT 1000` (configurable) to Dataview queries that lack a limit. This is useful to prevent memory leaks from larger queries. Use `--go` to apply changes.
- `dedup.py`: Deduplicates Markdown files in a directory by content, keeping a single canonical copy (preferably the one without or with the lowest numeric suffix), deleting the rest, and optionally renaming the survivor. Use `--go` to apply changes.
- `strip_frontmatter.py`: Recursively scans markdown files in a directory (defaults to flashcards subdirectory) and strips YAML frontmatter blocks, leaving only the body content. Use `--go` to apply changes.
- `unclobber_yaml_frontmatter.py`: Fixes duplicate or clobbered YAML front-matter blocks (typically introduced by merge conflicts). The script merges all front-matter sections found at the top of a Markdown file, resolves conflicts (earliest timestamps, union of lists, prompts for manual choice on other types), and rewrites the file with a single clean front-matter block. Use `--go` to apply changes.
## Installation
Optional: set `VAULT_PATH` and `VAULT_NAME` environment variables to avoid having to pass them as arguments to the scripts. For the `strip_frontmatter.py` script, you can also set `FLASHCARDS_PATH` to specify the flashcards directory directly. These can also be defined in the `.env` file.
```bash
# Create (or update) the project environment and install all runtime + dev deps
uv pip install -e '.[dev]'
# Register the Git hooks provided by pre-commit
uvx pre-commit install
```
### Running the linters & formatter
```bash
# Execute the full pre-commit suite across all files
uvx pre-commit run --all-files
```
### Running the tests
```bash
# Run the tests
uv run pytest
```
# Contributing
See CONTRIBUTING.md before making edits.