# Dynamic Text Highlighting Highlight text in your notes with your own search terms and regular expressions, turn placeholders such as `=TODO=` into badges, and see every occurrence of the word under the cursor. Highlighters work in the editor, and optionally in reading view and exported PDFs. ## Features - **Highlighters**: define search terms or regular expressions and choose how matches look: background, badge, text color, wavy underline or only a CSS class. - **Badges for placeholders**: show only the first capture group of a match, e.g. `=(TODO)=` renders as a `TODO` badge without the equals signs. In live preview the equals signs reappear while the cursor is inside. - **Reading view and PDF export**: highlighters can also apply to rendered notes, so badges and highlights end up in printed documents. - **Selection highlighting**: highlight all occurrences of the word under the cursor or of the selected text, with a minimum length, a match limit, a delay and a list of ignored words. - **Import and export**: share highlighters as JSON. Configurations of the Dynamic Highlights plugin can be imported, including its custom CSS. - **Commands**: toggle highlighters and selection highlighting from the command palette or a hotkey. Code blocks, inline code, math and front matter are never highlighted. ## Highlighters Open **Settings → Dynamic Text Highlighting** and add a highlighter with the plus button. Each highlighter has these options: | Option | Description | | --------------------------------- | -------------------------------------------------------------------------------------------------------- | | Name | Shown in the list of highlighters. | | Enabled | Turn a single highlighter on or off. | | Search | Text to find, or a regular expression. | | Regular expression | Treat the search as a JavaScript regular expression. | | Case sensitive | Match upper and lower case exactly. | | Style | Background, badge, text color, wavy underline, or none (CSS class only). | | Color | Color of the highlight. Text on backgrounds and badges switches between dark and light automatically. | | Show only the first capture group | Regular expressions only. Hide the rest of the match. | | Named groups as CSS classes | Regular expressions only. In the editor, a named group `(?...)` gets its name as CSS class. | | Highlight whole line | Tint the entire line of a match in the editor. | | Reading view and PDF export | Also highlight in rendered notes. | | CSS class | Extra class on every match, for styling with a CSS snippet. | Drag highlighters to reorder them. When matches overlap in reading view, the highlighter higher in the list wins. ### Default highlighters New installations start with three badge highlighters as an example: | Name | Search | Style | Color | | ----------- | ----------- | ----- | ------ | | TODO badge | `=(TODO)=` | Badge | Yellow | | FIXME badge | `=(FIXME)=` | Badge | Orange | | DONE badge | `=(DONE)=` | Badge | Green | ```markdown Chapter 3 =TODO= add sources The formula is not correct yet =FIXME= ``` ### Examples | Purpose | Search | Settings | | ----------------------------------- | ------------------------------ | ------------------------------------------------ | | Priority badges | `=(P[1-3])=` | Regex, badge, first capture group, reading view | | Filler words | `\b(basically\|actually\|very)\b` | Regex, wavy underline | | Repeated spaces | ` {2,}` | Regex, background | | Dates in ISO format | `\d{4}-\d{2}-\d{2}` | Regex, text color | | A name you want to spot | `Jane Doe` | Background | Regular expressions with lookbehind, such as `(?<=x)`, do not work on iOS versions older than 16.4. ## Styling with CSS snippets Every match has the classes `dth-match` and `dth-style-