Remove inka2 metadata from markdown files while preserving content
Project description
inka-clean
Remove inka2 metadata from markdown files while preserving content and adjusting heading hierarchy.
Overview
inka-clean is a Unix pipeline tool that processes markdown files containing inka2 flashcard sections. It removes inka2 metadata (delimiters, deck/tag specifications, ID comments, question numbers, answer prefixes) while preserving the actual content and intelligently adjusting heading levels to fit the surrounding markdown hierarchy.
Installation
uv tool install inka-clean
# or for development
cd inka-clean && make install
Usage
As a Unix pipeline tool (stdin → stdout):
# Read from stdin, write to stdout
cat file.md | inka-clean > output.md
# Direct file redirection
inka-clean < input.md > output.md
# With file argument
inka-clean input.md > output.md
# Chain with other tools
cat file.md | inka-clean | pandoc -o output.html
Example
Input:
## Outer Heading
Some content.
---
Deck: tools::vim
Tags: vim
<!--ID:1755681272665-->
1. How to format text paragraphs?
> `gq`
> `gqap` (current paragraph)
---
### Another Heading
More content.
Output:
## Outer Heading
Some content.
How to format text paragraphs?
`gq`
`gqap` (current paragraph)
### Another Heading
More content.
Features
- Metadata removal: Strips
---delimiters,Deck:,Tags:,<!--ID:-->comments - Prefix stripping: Removes
1.question numbers and>answer prefixes - Heading adjustment: Adjusts heading levels in inka2 content relative to surrounding context
- Edge case handling: Preserves code blocks, regular ordered lists, blockquotes, thematic breaks
- Performance: < 20ms for typical files
- Unix philosophy: Pure stdin/stdout, composable with other tools
Development
# Run tests (TDD)
make test
# Type check
make ty
# Lint and format
make lint
make format
# Run benchmarks
make bench
License
MIT
inka-clean
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file inka_clean-0.1.2.tar.gz.
File metadata
- Download URL: inka_clean-0.1.2.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf192a3cd62bcc287fc4981640901fe3fb5732c661e0cf6aec223a8eb1491bf0
|
|
| MD5 |
3e9e40e3892a623b98f84484430581cd
|
|
| BLAKE2b-256 |
460bd28a42a7b4a3fb9ab5d61fd11f4a1db08a86f36c99431cd19cb82ebe4e89
|
File details
Details for the file inka_clean-0.1.2-py3-none-any.whl.
File metadata
- Download URL: inka_clean-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2965456fb97b87c13c9162127a9466babb6549dcccb92b7ddf5475344239a6ce
|
|
| MD5 |
12761a4e5d728c793a9425dc48e38142
|
|
| BLAKE2b-256 |
96f3f842523833bc2593a8be108b0d62788a5968dbc303ac7473beee4f9f7a74
|