OpenAI/AskAI Response:
What This Script Does
- Converts mixed Markdown and LaTeX-style text into HTML.
- Transforms math ($$, $, \( \), \[ \], §§, §§§§) into
<span data-math-type="mhchem"> blocks. - Parses Markdown tables and outputs LaTeX-style arrays inside display math.
- Cleans and simplifies common LaTeX commands and formatting artifacts.
- Protects currency
$ values during math conversion and restores them later.
How It Processes & Outputs
- Escapes backslashes inside matrix/array environments for consistency.
- Builds HTML structure: headers, paragraphs, ordered/unordered lists.
- Detects math-like parentheses and wraps them as math spans when appropriate.
- Cleans nested math spans to remove unwanted HTML inside math regions.
- Copies both HTML (rich) and plain text versions to the clipboard.