MathJax rendering problem

fiona.alpha137's Avatar

fiona.alpha137

03 Aug, 2018 11:57 PM

// Please enter a detailed description of the issue // Description of the issue:

I have a very simple equation that I'd like to render with MathJax, but the position of the overhead arrow and the overhead wedge is at the wrong place (see the attached image of "Marked_preview"). Now, this isn't really a Marked problem nor MathJax problem, but seems to be a bug in Safari (see https://github.com/mathjax/MathJax/issues/1766). I've sort of verified that Safari has the problem, by exporting the html from Marked, adding a line to load MathJax with the same configuration as I use in Marked, and opening the html in Safari and Chrome. You can see in the picture (named "Safari" and "Chrome") that Chrome renders it correctly, while Safari doesn't. So my question is, is Marked using Safari in the preview? Is it possible to use Chrome in the preview instead? (I'm not very tech-savvy, sorry if the question doesn't make any sense.) Right now the only workaround I've found is to export the html, add the MathJax line by hand, open in Chrome and print to pdf, which is quite cumbersome.

// Please enter a list of steps required to reproduce the issue // Steps to reproduce:

  1. open the attached example.md file in Marked 2
  2. turn on MathJax in Marked 2, with configuration TeX-MML-AM_HTMLorMML-full

// If applicable please attach a sample document that causes the issue for you.

// Configuration (do not edit) Marked 2 953 (Direct)

macOS Version: 10.13.6

additionalMathJaxConfig: tex2jax: {
inlineMath: [["$","$"],["\(","\)"]], displayMath: [["$$","$$"],["\[","\]"]], processEscapes: true }, allowPageBreakInCode: TRUE
bookTxtIsLeanpub: TRUE
summaryMdIsGitBook: TRUE
codeIsPoetry: TRUE
codeCanWrap: TRUE
collapsibleHeadlines: TRUE
convertGithubCheckboxes: TRUE
convertYAMLToMMD: TRUE
defaultMathJaxConfig: TeX-MML-AM_HTMLorMML-full
defaultPreviewStyle: 4
defaultProcessor: MultiMarkdown
enableMiniMap: TRUE
excludeBlockQuotesFromCounts: TRUE
excludeFootnotesFromCounts: TRUE
excludeVerbatimFromCounts: TRUE
excludeCaptionsFromCounts: TRUE
folderPreviewExtensionsArray: md, markdown, txt, mdown, html, opml
githubNewlines: TRUE
h1IsPageBreak: TRUE
h2IsPageBreak: TRUE
hrIsPageBreak: TRUE
includeMathJax: TRUE
limitTextWidth: TRUE
minimalJavaScript: TRUE
outlineModeExtensions:
permissionGranted: TRUE
printHeaderBottomLeft:
printHeaderBottomRight:
printHeaderFirstPage: TRUE
printFooterFirstPage: TRUE
printHeaderTopLeft:
printHeaderTopRight:
processHTMLFiles: TRUE
removeMetadataForPreview: TRUE
removeYAMLHeaders: TRUE
scrollToEdit: TRUE
shouldDetectCritic: TRUE
shouldHighlightMarkupErrors: TRUE
shouldLoadCritic: TRUE
syntaxHighlight: TRUE

  1. Support Staff 1 Posted by Brett on 04 Aug, 2018 03:05 PM

    Brett's Avatar

    Hi Fiona,

    Almost all macOS applications with web views use the same rendering
    engine as Safari (Apple's Webkit). There's really no alternative to
    this. I can definitely see how having to export to Chrome to get proper
    output is a huge inconvenience, but I'm not sure I can do anything about
    it within Marked.

    -Brett

  2. Support Staff 2 Posted by Brett on 04 Aug, 2018 03:13 PM

    Brett's Avatar

    I did just test changing the MathJax configuration in the dropdown to TeX-MML-AM_SVG-full and it seems to correct the issue. Is that an acceptable solution for you?

  3. 3 Posted by fiona.alpha137 on 05 Aug, 2018 07:39 PM

    fiona.alpha137's Avatar

    Hi Brett,

    Thanks for the prompt reply.

    I see, I was expecting something along that line, but thanks for confirming.

    So with SVG I have a different problem that the exported pdf has all equations looking bold, although it looks very nice in the Marked preview; please see the attached image, left is preview in Marked, right is the exported pdf. I've also attached a snippet of the Markdown file used to generate the text. For this both Chrome and Safari act the same way: it looks very nice in the browser, but gets bold when exported/printed to pdf.

    -Fiona

  4. Support Staff 4 Posted by Brett on 06 Aug, 2018 01:11 PM

    Brett's Avatar

    I'm afraid I have no idea how to work around that. I'm sincerely sorry I
    can't be of more help on this.

    -Brett

  5. 5 Posted by fiona.alpha137 on 06 Aug, 2018 03:21 PM

    fiona.alpha137's Avatar

    Please don't worry, it's not a Marked 2 problem in the first place.

    After a bit more googling though, I found that the MathJax team has already hacked a workaround to the Safari problem in one of the later 2.7 release. Indeed the hat and the arrow are not displaced anymore in Safari if I load the latest 2.7.5 Mathjax (please see the attached html code, MathJax is loaded at the very top.) I think Marked is using MathJax 2.7.0 from what I see in the exported html with MathJax code included? Is it possible for you to change the default to the latest MathJax?

    -Fiona

  6. Support Staff 6 Posted by Brett on 06 Aug, 2018 03:35 PM

    Brett's Avatar

    That I can do. I'll update for the next release.

    -Brett

  7. 7 Posted by fiona.alpha137 on 06 Aug, 2018 05:41 PM

    fiona.alpha137's Avatar

    Great, thank you!

    By the way, Marked 2 (and nvALT!) really is a superb app; my life became so much better once I got Marked 2 and made my workflow revolve around it. Thank you for making such a great product!

    -Fiona

  8. Support Staff 8 Posted by Brett on 06 Aug, 2018 06:00 PM

    Brett's Avatar

    Thanks for the kind words!

  9. fiona.alpha137 closed this discussion on 06 Aug, 2018 08:40 PM.

  10. fiona.alpha137 re-opened this discussion on 06 Aug, 2018 08:43 PM

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • Chrome.png 5.29 KB
  • example.html 369 KB
  • example.md 35 Bytes
  • Marked_preview.png 24.2 KB
  • MathJax_configuration.png 256 KB
  • Safari.png 5.12 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac