close
Skip to content

html backend: persistent katex macros#1391

Merged
jonludlam merged 3 commits into
ocaml:masterfrom
dlesbre:dlesbre/katex-options
Nov 21, 2025
Merged

html backend: persistent katex macros#1391
jonludlam merged 3 commits into
ocaml:masterfrom
dlesbre:dlesbre/katex-options

Conversation

@dlesbre
Copy link
Copy Markdown
Contributor

@dlesbre dlesbre commented Nov 18, 2025

Previously, if you defined a macro using \gdef in a math block, that macro would only be scoped to that block in the HTML KaTeX render. This PR adds persistent macros, allowing you to reuse that same macro in all subsequent math blocks.

Locally scoped macros are still possible using the \def command.

This is in accordance to the KaTeX documentation on macros:

Macros defined by \gdef, \xdef, \global\def, \global\edef, \global\let, and \global\futurelet will persist between math expressions.

The solution I used here is explained in the KateX API documentation.

@jonludlam
Copy link
Copy Markdown
Member

Thanks @dlesbre !

@jonludlam jonludlam merged commit 40bae1e into ocaml:master Nov 21, 2025
10 of 11 checks passed
jonludlam added a commit to jonludlam/opam-repository that referenced this pull request May 1, 2026
CHANGES:

- Allow persistent latex macros in HTML/KaTeX backend (@dlesbre, ocaml/odoc#1391)
- `markdown-generate` command now accepts multiple `.odocl` files in a single
  invocation, eliminating the need for shell scripting (@davesnx, ocaml/odoc#1387)
- Support for OxCaml (@lukemaurer, @art-w, ocaml/odoc#1399)
- OCaml 5.5.0 support (@panglesd, @xvw, ocaml/odoc#1406)

- Fix compile-time crashing bugs ocaml/odoc#930 and ocaml/odoc#1385 (@jonludlam, ocaml/odoc#1400)
- Markdown backend assumes ocaml as langId on declarations
- Markdown backend collects all code snippets and render a single code block with comments, rather than split the variants/records per constructor/field
- Fix URL remapping for page references (@jonludlam, ocaml/odoc#1395)
- Fix ocaml/odoc#1396, which broke incrememntal builds (@jonludlam, ocaml/odoc#1402)
- Ensure all warnings turn into errors with --warn-error (@jonludlam, ocaml/odoc#1402)
- Fix missing parentheses for polymorphic arguments (@art-w, ocaml/odoc#1404)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants