# Highlights to Flashcards > Turn ==marked== text or PDF highlights into page-referenced notes and cloze or Q/A cards. Collects what you highlighted — ==marked== or bold passages and > quotes in pasted notes, or the highlight and underline annotations of a PDF — into a note list with page references, and turns each into a flashcard: short highlights become cloze gaps of their sentence, definitions become question-and-answer cards, longer passages become recall cards. The cards use the shared syntax of Lessonleaf and Deckwright and open in Deckwright’s Study view. Rule-based, no AI. Part of usefulweb.app (https://usefulweb.app/). Part of [Lessonleaf](https://lessonleaf.usefulweb.app/) (ownerApp: lessonleaf). Results are deterministic calculations from the inputs and the listed assumptions; the API returns exactly what the web page shows. ## Use it - Human interface: https://highlightstoflashcards.usefulweb.app/ (interactive tool at https://highlightstoflashcards.usefulweb.app/tool) - JSON API: POST https://highlightstoflashcards.usefulweb.app/api/v1/calculate with a JSON object of inputs (schema: https://highlightstoflashcards.usefulweb.app/api/v1/tool) - OpenAPI: https://highlightstoflashcards.usefulweb.app/openapi.json - MCP (Streamable HTTP): https://highlightstoflashcards.usefulweb.app/mcp - tool `highlights_to_flashcards` ## Inputs - text (textarea): Text with highlights - Mark passages with ==double equals==, … or **bold**; lines starting with > are quotes. “Page 12” lines or form feeds set page numbers, # headings the section. Ignored when a PDF is uploaded. - file (file): Or a PDF with highlights - Highlight, underline, squiggly and strike-out annotations; at most 300 pages. Scanned pages without a text layer cannot be read. - cardStyle (select): Card style - bold (boolean): Bold text counts as a highlight - quotes (boolean): Quote lines (>) count as highlights - maxClozeWords (integer): Longest highlight for a cloze gap - lang (text): Language of the text (for definition questions) - “What is …?” questions are only written for English; other languages use “Term: definition” lines. - title (text): Title ## Method - Pasted text: ==…== and … are highlights, **…** and __…__ too (switchable), and every block of “>” lines is one quote. # headings set the section, “Page 12”, “p. 12”, “[p. 12]” lines or form feeds the page. - PDF: pdftotext lists every word with its box; qpdf reads the Highlight, Underline, Squiggly and StrikeOut annotations with their QuadPoints. A word belongs to a highlight when its centre lies inside one of the quadrilaterals (1 pt tolerance) and it overlaps at least half its height; words keep the reading order of the page, hyphenated line breaks are joined. The sentence around the highlight is found by walking to the nearest . ! ? before and after it. - Cards: a highlight of at most N words that covers less than 60 % of its sentence becomes a {{c1::…}} gap (several highlights in one sentence share one note with c1, c2 …). Longer passages become a Q/A card when they read like a definition (“Term: …”, “Term – …”, or in English “X is/are/means/refers to …”), a cloze when marked words are inside a quote, and otherwise a “recall the passage” card. - The cards are written in the shared card syntax and read back with the same parser as Deckwright’s Study view and Lessonleaf, so the card count shown is what those apps will show. ## Limits - Rule-based: the cards are only as good as the highlights. Check each card before studying. Scanned PDFs have no text layer — run them through OCR first. The PDF is processed on the server for this request and not kept.