Skip to content

Enable single-dollar inline LaTeX rendering in MathJax#62

Merged
ThisIs-Developer merged 4 commits intomainfrom
copilot/fix-latex-inline-rendering
Apr 2, 2026
Merged

Enable single-dollar inline LaTeX rendering in MathJax#62
ThisIs-Developer merged 4 commits intomainfrom
copilot/fix-latex-inline-rendering

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

Inline LaTeX expressions wrapped with single $...$ were rendering as plain text, while $$...$$ display math rendered correctly. This PR configures MathJax delimiter parsing so inline and display expressions are both handled as expected.

  • MathJax initialization

    • Added explicit window.MathJax config before loading the MathJax bundle.
    • Enabled inline delimiters for single-dollar and \(...\).
    • Preserved display delimiters for $$...$$ and \[...\].
    • Enabled processEscapes to avoid unintended parsing for escaped dollar signs.
  • Web + desktop parity

    • Applied the same config in both:
      • index.html
      • desktop-app/resources/index.html
    • Keeps rendering behavior consistent across browser and desktop builds.
<script>
  window.MathJax = {
    tex: {
      inlineMath: [['$', '$'], ['\\(', '\\)']],
      displayMath: [['$$', '$$'], ['\\[', '\\]']],
      processEscapes: true
    }
  };
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.min.js"></script>

Copilot AI linked an issue Apr 2, 2026 that may be closed by this pull request
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
markdown-viwer Ready Ready Preview, Comment Apr 2, 2026 5:06am

Agent-Logs-Url: https://github.com/ThisIs-Developer/Markdown-Viewer/sessions/25e889c7-d501-4e74-9e49-01839bcf0feb

Co-authored-by: ThisIs-Developer <109382325+ThisIs-Developer@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Apr 2, 2026

Deploying markdown-viewer with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4144576
Status: ✅  Deploy successful!
Preview URL: https://ab1fb9f9.markdown-viewer.pages.dev
Branch Preview URL: https://copilot-fix-latex-inline-ren.markdown-viewer.pages.dev

View logs

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Apr 2, 2026

Deploying markdownviewer with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4144576
Status: ✅  Deploy successful!
Preview URL: https://1644964b.markdownviewer.pages.dev
Branch Preview URL: https://copilot-fix-latex-inline-ren.markdownviewer.pages.dev

View logs

Agent-Logs-Url: https://github.com/ThisIs-Developer/Markdown-Viewer/sessions/25e889c7-d501-4e74-9e49-01839bcf0feb

Co-authored-by: ThisIs-Developer <109382325+ThisIs-Developer@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix inline LaTeX expressions rendering issue Enable single-dollar inline LaTeX rendering in MathJax Apr 2, 2026
Copilot AI requested a review from ThisIs-Developer April 2, 2026 05:07
@ThisIs-Developer ThisIs-Developer marked this pull request as ready for review April 2, 2026 05:21
Copilot AI review requested due to automatic review settings April 2, 2026 05:21
@ThisIs-Developer ThisIs-Developer merged commit 0611723 into main Apr 2, 2026
6 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Configures MathJax so inline LaTeX wrapped with single dollar delimiters ($...$) renders correctly (in addition to existing display math support), aiming for consistent behavior across web and desktop builds.

Changes:

  • Added an explicit window.MathJax configuration (inline + display delimiters, processEscapes) before loading the MathJax bundle.
  • Applied the same MathJax setup in both index.html and desktop-app/resources/index.html.
  • Updated the desktop GitHub import modal markup to include a selection toolbar and tree container (additional change beyond MathJax scope).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
index.html Adds MathJax delimiter configuration prior to loading MathJax to enable $...$ inline rendering.
desktop-app/resources/index.html Mirrors the MathJax config and also introduces additional GitHub import modal UI elements.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pako/2.1.0/pako.min.js" integrity="sha384-rNlaE5fs9dGIjmxWDALQh/RBAaGRYT5ChrzHo6tRfgrZ36iRFAiquP5g41Jsv+0j" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/4.1.0/js-yaml.min.js"></script>
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

js-yaml is newly loaded here, but the desktop bundle (desktop-app/resources/js/script.js and main.js) doesn’t reference the jsyaml global. If it’s not needed on desktop, consider removing this script tag to avoid an extra CDN dependency and unnecessary load time; if it is needed, add/verify the corresponding usage so this include is justified.

Suggested change
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/4.1.0/js-yaml.min.js"></script>

Copilot uses AI. Check for mistakes.
Comment on lines +289 to +293
<div id="github-import-selection-toolbar" class="github-import-selection-toolbar" style="display:none;">
<span id="github-import-selected-count" class="github-import-selected-count">0 selected</span>
<button type="button" class="reset-modal-btn" id="github-import-select-all">Select All</button>
</div>
<div id="github-import-tree" class="github-import-tree" style="display:none;"></div>
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change introduces the GitHub import selection toolbar and tree container, but desktop-app/resources/js/script.js currently implements GitHub import via the <select id="github-import-file-select"> flow and doesn’t reference these new elements/IDs. Either wire up the desktop GitHub import logic to use the new tree-based UI (matching the web implementation) or remove these unused elements to keep the desktop UI/DOM minimal and avoid future confusion.

Suggested change
<div id="github-import-selection-toolbar" class="github-import-selection-toolbar" style="display:none;">
<span id="github-import-selected-count" class="github-import-selected-count">0 selected</span>
<button type="button" class="reset-modal-btn" id="github-import-select-all">Select All</button>
</div>
<div id="github-import-tree" class="github-import-tree" style="display:none;"></div>

Copilot uses AI. Check for mistakes.
Comment on lines +289 to +293
<div id="github-import-selection-toolbar" class="github-import-selection-toolbar" style="display:none;">
<span id="github-import-selected-count" class="github-import-selected-count">0 selected</span>
<button type="button" class="reset-modal-btn" id="github-import-select-all">Select All</button>
</div>
<div id="github-import-tree" class="github-import-tree" style="display:none;"></div>
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description is scoped to MathJax delimiter configuration, but this hunk also changes the GitHub import modal UI (selection toolbar + file tree) for the desktop app. Please confirm this is intentional and update the PR description (or split into a separate PR) so reviewers understand the additional behavior/UI change being shipped.

Copilot uses AI. Check for mistakes.
@ThisIs-Developer ThisIs-Developer deleted the copilot/fix-latex-inline-rendering branch April 3, 2026 04:29
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.

LaTeX inline expression render

3 participants