As far as I know, not with “vanilla” DocC. To add an <svg> to the DocC-generated website, we’d have to process the website after DocC generates it (with a custom script, or a compiler plugin, etc). But, if we’re going to do that, then we might as well emit a <math> instead of an <svg>.
Embed math using <math> |
Embed math using <svg>, <embed>, <object>, etc |
|---|---|
To support dark mode, nothing needs to be done because <math> uses the current font color. |
To support dark mode, we’d also have to change the generated webpage’s stylesheet to add a media query (this can’t be done with inline styles). |
| Users viewing the documentation webpage with a screen reader can navigate the equation. | Possibly insufficient accessibility. |
Though, instead of doing either of these, I’ll personally stick to vanilla DocC and just embed math as an <img> of a .svg (using the MathML-in-SVG trick in my original comment, though people who prefer LaTeX over MathML can instead compile their LaTeX to .svg).
That said, if DocC were to gain first-class support for mathematical typesetting in the future, then embedding math into documentation pages via <math> (the ideal approach) would become tractable. I’ve made a separate post about this here.