{"id":21500811,"url":"https://github.com/mcanouil/quarto-highlight-text","last_synced_at":"2026-05-31T14:00:50.445Z","repository":{"id":238013433,"uuid":"795686327","full_name":"mcanouil/quarto-highlight-text","owner":"mcanouil","description":"Quarto extension that allows to highlight text in a document for various formats: HTML, LaTeX, Typst, Docx, PowerPoint, Reveal.js, and Beamer.","archived":false,"fork":false,"pushed_at":"2026-04-15T20:36:45.000Z","size":168,"stargazers_count":48,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-19T00:41:32.160Z","etag":null,"topics":["docx","highlight","highlight-text","html","latex","quarto","quarto-extension","quarto-filter","quarto-pub","quartopub","stable","typst"],"latest_commit_sha":null,"homepage":"https://m.canouil.dev/quarto-highlight-text/","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcanouil.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"mcanouil","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2024-05-03T20:09:15.000Z","updated_at":"2026-05-12T02:36:18.000Z","dependencies_parsed_at":"2025-03-15T01:20:02.850Z","dependency_job_id":"4bca5bfd-e43c-4347-826d-086cf27684ba","html_url":"https://github.com/mcanouil/quarto-highlight-text","commit_stats":null,"previous_names":["mcanouil/quarto-highlight-text"],"tags_count":31,"template":false,"template_full_name":null,"purl":"pkg:github/mcanouil/quarto-highlight-text","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcanouil%2Fquarto-highlight-text","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcanouil%2Fquarto-highlight-text/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcanouil%2Fquarto-highlight-text/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcanouil%2Fquarto-highlight-text/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcanouil","download_url":"https://codeload.github.com/mcanouil/quarto-highlight-text/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcanouil%2Fquarto-highlight-text/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33733754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docx","highlight","highlight-text","html","latex","quarto","quarto-extension","quarto-filter","quarto-pub","quartopub","stable","typst"],"created_at":"2024-11-23T17:47:45.829Z","updated_at":"2026-05-31T14:00:50.439Z","avatar_url":"https://github.com/mcanouil.png","language":"Lua","funding_links":["https://github.com/sponsors/mcanouil"],"categories":[],"sub_categories":[],"readme":"# Highlight-text Extension For Quarto\n\nThis is a Quarto extension that allows to highlight text in a document for various formats: HTML, LaTeX, Typst, Docx, PowerPoint, Reveal.js, and Beamer.\n\n## Installation\n\n```bash\nquarto add mcanouil/quarto-highlight-text@2.3.0\n```\n\nThis will install the extension under the `_extensions` subdirectory.\n\nIf you're using version control, you will want to check in this directory.\n\n## Usage\n\nTo use the extension, add the following to your document's front matter:\n\n```yaml\nfilters:\n  - highlight-text\n```\n\nThen you can use either span syntax for inline highlighting or div syntax for block-level highlighting.\n\n### Inline Highlighting (Spans)\n\nHighlight text inline using span syntax:\n\n```markdown\n[Red]{colour=\"#b22222\" bg-colour=\"#abc123\"} # UK spelling\n[Blue]{color=\"#0000ff\" bg-color=\"#abc123\"} # US spelling\n```\n\n### Block Highlighting (Divs)\n\nHighlight entire blocks using div syntax:\n\n```markdown\n::: {fg=\"#ffffff\" bg=\"#0000ff\"}\nThis is a block-level highlighted section.\n\nIt can contain multiple paragraphs, lists, and other content.\n:::\n```\n\n### Shorter Syntax\n\nYou can use abbreviated attribute names:\n\n```markdown\n[Red text]{fg=\"#b22222\"}\n[Red text (ink alias)]{ink=\"#b22222\"}\n[Red background]{bg=\"#abc123\"}\n[Red background (paper alias)]{paper=\"#abc123\"}\n[White on Red]{fg=\"#ffffff\" bg=\"#b22222\"}\n[White on Red (ink/paper aliases)]{ink=\"#ffffff\" paper=\"#b22222\"}\n[Text with solid border]{bc=\"#0000ff\"}\n[Text with dashed border]{bc=\"#b22222\" bs=\"dashed\"}\n[Text with dotted border]{bc=\"#00aa00\" border-style=\"dotted\"}\n```\n\nFor block-level highlighting:\n\n```markdown\n::: {fg=\"#ffffff\" bg=\"#b22222\"}\nBlock with white text on red background.\n:::\n\n::: {ink=\"#ffffff\" paper=\"#b22222\"}\nBlock with white text on red background (ink/paper aliases).\n:::\n\n::: {bc=\"#b22222\" bg=\"#ffffcc\"}\nBlock with red solid border and light yellow background.\n:::\n\n::: {bc=\"#0000ff\" bg=\"#f0f0f0\" bs=\"dashed\"}\nBlock with blue dashed border and light grey background.\n:::\n```\n\nSupported attributes:\n\n- **Foreground (text) colour**: `ink`, `fg`, `colour`, or `color`.\n- **Background colour**: `paper`, `bg`, `bg-colour`, or `bg-color`.\n- **Border colour**: `bc`, `border-colour`, or `border-color`.\n- **Border style**: `bs` or `border-style` (values: `solid`, `dashed`, `dotted`, `double`; defaults to `solid`).\n- **Opacity** (HTML and Typst): `opacity` accepts a number in `[0, 1]` or a percentage (e.g. `\"50%\"`). Applied to the background when present, otherwise to the element as a whole.\n- **Gradient fill** (HTML and Typst, block-level only): `gradient` accepts a full `linear-gradient(...)`/`radial-gradient(...)` value or a comma-separated list of colour stops (becomes a left-to-right linear gradient). Typst output uses native `gradient.linear`/`gradient.radial`.\n\nColour values accept hex codes (`#RGB`/`#RRGGBB`), CSS functional notation (`rgb()`, `hsl()`, `hwb()`), CSS named colours, brand colour names, and CSS custom properties (`var(--brand-primary)`).\nCSS `var()` references are only resolved by the browser, so they apply to HTML/RevealJS output only.\nInvalid colour values are skipped with a warning rather than producing malformed output.\n\n### Using Brand Colours\n\nDefine colours once in `_brand.yml` and reference them throughout your documents:\n\n```yaml\ncolor:\n  palette:\n    red: \"#b22222\"\n    custom-blue: \"#0000ff\"\n  primary: \"#abc123\"\n```\n\nReference these colours directly by name:\n\n```markdown\n[Red text]{fg=\"red\"}\n[Custom background]{bg=\"custom-blue\"}\n[Primary highlight]{bg=\"primary\"}\n```\n\n\u003e [!NOTE]\n\u003e The old `brand-color.` prefix syntax (e.g., `colour=\"brand-color.red\"`) is deprecated but still supported.\n\u003e You'll see a warning when using it.\n\u003e Use the colour name directly instead: `colour=\"red\"`.\n\n### Light and Dark Theme Support\n\nWith Quarto CLI ≥1.7.28, you can define different colours for light and dark themes:\n\n**Option 1**: Define themes in document front matter:\n\n```yaml\nbrand:\n  light:\n    color:\n      palette:\n        fg: \"#ffffff\"\n        bg: \"#b22222\"\n  dark:\n    color:\n      palette:\n        fg: \"#b22222\"\n        bg: \"#ffffff\"\n```\n\n**Option 2**: Use external `_brand.yml` file:\n\n```yaml\nbrand:\n  light: _brand.yml\n  dark: _brand-dark.yml\n```\n\nThen reference theme-aware colours:\n\n```markdown\n[This text adapts to theme]{fg=\"fg\" bg=\"bg\"}\n```\n\n\u003e [!NOTE]\n\u003e Only HTML formats support dynamic light/dark mode switching.\n\u003e Other formats will use the light mode colours if available, or fall back to dark mode colours otherwise, unless specified otherwise.\n\n## Limitations\n\n### LaTeX/PDF Output\n\nThe LaTeX `\\colorbox` command does not support line wrapping for highlighted text with background colours.\nLong highlighted text may overflow or break awkwardly.\n\n**For inline highlighting**: Use the `par=true` attribute to add `\\parbox{\\linewidth}` (XeLaTeX and PDFLaTeX only):\n\n```markdown\n[Long text with background]{colour=\"#b22222\" bg-colour=\"#abc123\" par=true}\n```\n\n**For block-level highlighting**: Automatic line wrapping is enabled for all engines.\nBlock divs automatically use `\\parbox` for non-LuaLaTeX engines.\n\n**Best solution**: Use LuaLaTeX as your PDF engine for proper line wrapping with the `lua-ul` package:\n\n```yaml\nformat:\n  pdf:\n    pdf-engine: lualatex\n```\n\n\u003e [!NOTE]\n\u003e LuaLaTeX is the default PDF engine in Quarto CLI ≥1.8.25.\n\n### PowerPoint Output\n\nLinks are not supported in highlighted text in PowerPoint output, *i.e.*, URLs will be rendered using default styles.\n\nBorder colour is not supported in PowerPoint output.\nA warning is emitted once per render when a border colour is requested for PowerPoint.\n\n### Word Output\n\nLinks are not supported in highlighted text in Word output, *i.e.*, URLs will be rendered using default styles.\n\n## Example\n\nHere is the source code for a minimal example: [`example.qmd`](example.qmd).\n\nOutput of `example.qmd`:\n\n- [HTML](https://m.canouil.dev/quarto-highlight-text/)\n- [Typst/PDF](https://m.canouil.dev/quarto-highlight-text/highlight-typst.pdf)\n- [LaTeX/PDF (XeLaTeX)](https://m.canouil.dev/quarto-highlight-text/highlight-xelatex.pdf)\n- [LaTeX/PDF (LuaLaTeX)](https://m.canouil.dev/quarto-highlight-text/highlight-lualatex.pdf)\n- [LaTeX/PDF (PDFLaTeX)](https://m.canouil.dev/quarto-highlight-text/highlight-pdflatex.pdf)\n- [Word/Docx](https://m.canouil.dev/quarto-highlight-text/highlight-openxml.docx) (**only supports plain text, *i.e.*, no URLs**)\n- [Reveal.js](https://m.canouil.dev/quarto-highlight-text/highlight-revealjs.html)\n- [Beamer/PDF](https://m.canouil.dev/quarto-highlight-text/highlight-beamer.pdf)\n- [PowerPoint/Pptx](https://m.canouil.dev/quarto-highlight-text/highlight-pptx.pptx) (**only supports plain text, *i.e.*, no URLs**)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcanouil%2Fquarto-highlight-text","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcanouil%2Fquarto-highlight-text","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcanouil%2Fquarto-highlight-text/lists"}