riptano / docs-ui

The UI and theme for DataStax Docs.
https://riptano.github.io/docs-ui/
Mozilla Public License 2.0
2 stars 0 forks source link

STEM support #90

Open eric-schneider opened 6 months ago

eric-schneider commented 6 months ago

There are certain pages in the docs where we may need to display equations and other types of math. Currently, we have to manually create SVG files to present this kind of information, which is labor-intensive to create, update, and make compatible with our CSS styles.

To alleviate this problem, the AsciiDoc language provides STEM support for embedding math-mode macros from LaTeX and/or AsciiMath notation as block or inline elements (see docs-ui preview). These elements act as passthroughs to preserve the expressions as entered. The expressions are then passed on to the converter to be processed and rendered for display using a STEM provider (e.g., MathJax).

The STEM provider must be configured in the output converter to render the expressions. As far as implementation goes, we should thoroughly review the discussion in Antora Issue #184 and investigate the options presented. The simplest approach would probably be to load MathJax via CDN on just the pages that use stem. (That's the approach the Apache Cassandra project went with: https://github.com/apache/cassandra-website/pull/215.) However, as pointed out in the Antora discussion, using a CDN is a security risk. But coming up with an offline alternative might be tricky. The offline approach presented in this comment might be a good place to start since it appears to have the semi-endorsement of the Antora maintainers.