pages/assets/js
Suraj Khamkar da32034525
Fix issue causing no color inversion when rendering equations (#2956)
## Problem Description

When dark mode is enabled, inline math expressions rendered using
`$...$` in distill-style blog posts are displayed in black text. This
makes them difficult to read against the dark background. The issue
occurs because the default styles for MathJax-rendered content do not
account for dark mode and set the text color to black.

## Proposed Solution

This PR updates the MathJax setup to dynamically apply inline styles to
ensure the text color of MathJax-rendered content inherits the parent
container’s color. Specifically:
- Added a custom action in the _MathJax.options.renderActions_ section
to inject a CSS rule that sets _.mjx-container_ to inherit its color
from its parent element.
- Ensures that inline math expressions render correctly in both light
and dark modes without explicitly setting a fixed color.

## Changes Made
Modified the _mathjax-setup.js_ file to include:
- Custom inline styles injected via JavaScript for _.mjx-container_
elements.
- Explicit handling of _inlineMath_ delimiters to ensure consistency in
rendering.

## Testing and Validation
- Tested the fix in both light and dark modes to confirm that inline
math expressions render in the correct color.
- Verified that the changes do not introduce regressions in light mode
or affect block math expressions rendered using `$$...$$`.

## Impact
- Improves readability of inline math expressions in dark mode.
- Provides a consistent user experience for distill-style blog posts
across light and dark themes.
- Resolves #2915

Co-authored-by: Suraj Khamkar <surajk@atlanticpkg.com>
2025-01-15 23:11:44 -03:00
..
distillpub format code with prettier.io (#2048) 2024-01-10 00:10:51 -05:00
search Fixed bug when search result is inside description of external post (#2710) 2024-09-20 19:04:17 -03:00
bibsearch.js Fixed error in bibsearch.js 2024-07-13 14:05:20 -03:00
bootstrap-toc.min.js Fix prettier (#2062) 2024-01-10 11:21:58 -03:00
bootstrap.bundle.min.js Fix prettier (#2062) 2024-01-10 11:21:58 -03:00
bootstrap.bundle.min.js.map Added support to PurgeCSS (#1562) 2023-09-28 14:22:42 -03:00
chartjs-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
common.js Support superscripts in bibtex author names (#2512) 2024-06-19 14:34:54 -03:00
copy_code.js Support for diff2html (#2133) 2024-01-28 12:45:20 -03:00
cronitor-analytics-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
diff2html-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
echarts-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
google-analytics-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
highlight-search-term.js feat: simple filtering / searching on bibliography (#2523) 2024-07-08 16:51:22 -03:00
jupyter_new_tab.js Add functionality to open external links in jupyter notebooks in new tab (#2233) 2024-02-27 12:25:16 -03:00
leaflet-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
masonry.js format code with prettier.io (#2048) 2024-01-10 00:10:51 -05:00
mathjax-setup.js Fix issue causing no color inversion when rendering equations (#2956) 2025-01-15 23:11:44 -03:00
mermaid-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
newsletter.js Added missing newsletter components (#2913) 2024-12-26 16:49:45 -03:00
no_defer.js Remove bootstrap-table from archive tables (#2306) 2024-04-03 15:35:18 -03:00
open-panel-analytics-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
photoswipe-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
progress-bar.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
pseudocode-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
search-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
shortcut-key.js Fix code blocks not changing to plots and others (#2497) 2024-06-11 14:06:38 -03:00
tabs.min.js Added support for jekyll-tabs (#2380) 2024-05-02 14:34:48 -03:00
theme.js Added support for search (#2415) 2024-05-23 23:21:16 -03:00
tooltips-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
typograms.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
vanilla-back-to-top.min.js Fix: Add back-to-top button (#2433) 2024-05-24 15:58:55 -03:00
vega-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
venobox-setup.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
wechat.js Replaced jekyll-minifier that uses uglifier by terser (#2571) 2024-12-23 14:00:58 -03:00
zoom.js format code with prettier.io (#2048) 2024-01-10 00:10:51 -05:00