Extracts highlighted text from reMarkable PDF exports and converts them to Anki cloze deletion cards.
# Install dependencies
uv sync
# Run with interactive PDF picker
uv run parse.py
# Parse a specific PDF file
uv run parse.py testpage.pdf
# Parse all PDFs in the input/ folder
uv run parse.py all- Yellow (#FFED75): Marks sections that become cards
- Pink, Orange, Blue, Gray, Green: Mark text to be clozed (hidden)
-
Processed Cards: Yellow section + cloze colors
- Text from yellow section with cloze-colored parts wrapped in
{{c1::text}} - Multiple cloze colors get different numbers (c1, c2, c3...)
- Consecutive words with the same color are grouped into one cloze deletion
- Text from yellow section with cloze-colored parts wrapped in
-
Unprocessed Cards: Yellow section only (no cloze colors)
- Prefixed with "UNPROCESSED: "
- Last word automatically clozed
-
Orphan Highlights: Cloze colors without yellow underneath
- Exported to
output/unfinished/folder - Warning printed to console
- Exported to
# Interactive mode - select from list (includes "Parse ALL" option)
uv run parse.py
# Parse specific file
uv run parse.py myfile.pdf
# Parse all PDFs in input/ folder (also accepts --all or -a)
uv run parse.py allThe interactive mode displays all PDF files in the input/ folder and includes a "Parse ALL PDFs" option at the end of the list.
Edit parse.py to configure:
PDF_PATH = "" # Leave empty for interactive picker
PAGE_OFFSET = 0 # Add to PDF page numbers (e.g., 35 for book pages)remarkable/
├── input/ # Place PDF files here
├── output/ # Generated cards go here
│ ├── cards_{pdfname}_{YYYYMMDD_HHMM}.txt
│ └── unfinished/ # Orphan highlights
│ └── cards_{pdfname}_{YYYYMMDD_HHMM}.txt
└── parse.py # Main script
Output files include the source PDF name for easy identification.
Anki-importable text files with headers:
#separator:tab
#html:true
#tags column:3
"Card front with {{c1::cloze}}" Page X
Import into Anki:
- File → Import
- Select generated
.txtfile - Choose "Cloze" note type
- Map fields: Front → Text, Back Extra → Page
Highlighting in reMarkable:
- Yellow highlight: "The Internet uses packet switching to send data"
- Pink overlay on: "packet switching"
- Orange overlay on: "data"
Generated card:
"The Internet uses {{c1::packet switching}} to send {{c2::data}}" Page 36
Tested with:
- Single-page PDFs with various color combinations
- Multi-page PDFs (150+ pages)
- Page offset configuration
- Interactive and command-line modes