Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8440341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:16:06+00:00 2026-06-10T08:16:06+00:00

UPDATED POST Ok I’ve managed to make Markdown and MathJax work together, it was

  • 0

UPDATED POST

Ok I’ve managed to make Markdown and MathJax work together, it was relatively simple actually. I’ve used marked together with MathJax.

$(function() {
    var $text       = $("#text"), // the markdown textarea
        $preview    = $("#preview"); // the preview div

    $text.on("keyup", function() {
        $preview.html( marked($text.val()) ); // parse markdown
        MathJax.Hub.Queue(["Typeset", MathJax.Hub, "preview"]); // then let MathJax do its job
    })
});

Problem now is: I think markdown is parsing my math 1st before MathJax can change it. How do i fix this? I think its fixed on Math StackOverflow, but how? I need to stop markdown from parsing math

UPDATE 2

This works, but not sure if its the way math.stackexchange does it, but it seems to produce similar/same results with what I tested so far …

$(function() {
    var $text       = $("#text"),
        $preview    = $("#preview");

    $text.on("keyup", function() {
        $preview.html( $text.val() );
        MathJax.Hub.Queue(["Typeset", MathJax.Hub, "preview"]);
    });

    MathJax.Hub.Register.MessageHook("End Process", function (message) {
        $preview.html( marked($preview.html()) );
    });
});

OLD POST BELOW

In the math stackexchange, I can use MathJax with Markdown. I wonder what do I need to do that? I can use a library like marked to render Markdown, but for MathJax, it seems like it just renders on page loads. How can I call it to re-render or better just render whats needed (specified by me)

html = marked("some markdown string") // a HTML string
// is there something like
html = MathJax.parse(html)

UPDATE

I think I should be looking at http://www.mathjax.org/docs/1.1/typeset.html#manipulating-individual-math-elements. But when I try

$text.on("keyup", function() {
    $preview.html( marked($text.val()) );
    var math = MathJax.Hub.getAllJax("preview");
    console.log(math);
    MathJax.Hub.Queue(["Text", math, "a+b"]);
})

Where:

  • $text: is the jQuery element for my textarea
  • $preview: is the preview div

I find that math is undefined, so it seems var math = MathJax.Hub.getAllJax("preview") is not working. I have a div#preview btw.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:16:08+00:00Added an answer on June 10, 2026 at 8:16 am

    The fastest way is to protect the math from your markdown-parser.

    See this question for a detailed answer by Davide Cervone, including a link to the code used by math.SE.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Updated: After my initial post and responses, I managed to have another crack and
-- This is an updated post, old post removed -- Suppose I have data
UPDATED See post #3 below. There is a need to upload a file to
Backbone.js sents an POST on updated objects instead of an PUT. I think this
Updated Question: $(this).attr(EmployeeId, 'A42345'); $.ajax({ type: POST, url: url, data: {EmployeeId: ' + id
Update Solution Found See Bottom of post if interested Seems simple enough and for
I updated my post. Now it says link is not defined thisLink[link].scopeObject = new
Post updated to reflect partial fix suggested by @Kate. Original post below new post:
The post is updated. Please kindly jump to the Solution part, if you've already
(post updated for working code) I've been trying to get my android app to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.