Note that there are some explanatory texts on larger screens.

plurals
  1. POBrowser dependent problem rendering WMD with Showdown.js?
    text
    copied!<p>This should be easy (at least no one else seems to be having a similar problem), but I can't see where it is breaking.</p> <p>I'm storing Markdown'ed text in a database that is entered on a page in my app. The text is entered using WMD and the live preview looks correct.</p> <p>On another page, I'm retrieving the markdown text and using Showdown.js to convert it back to HTML client-side for display.</p> <p>Let's say I have this text:</p> <pre><code>The quick **brown** fox jumped over the *lazy* dogs. 1. one 1. two 4. three 17. four </code></pre> <p>I'm using this snippet of Javascript in my jQuery document ready event to convert it:</p> <pre><code>var sd = new Attacklab.showdown.converter(); $(".ClassOfThingsIWantConverted").each(function() { this.innerHTML = sd.makeHtml($(this).html()); } </code></pre> <p>I suspect this is where my problem is, but it <em>almost</em> works.</p> <p>In FireFox, I get what I expected:</p> <p>The quick <strong>brown</strong> fox jumped over the <em>lazy</em> dogs.</p> <ol> <li>one</li> <li>two</li> <li>three</li> <li>four</li> </ol> <p>But in IE (7 and 6), I get this:</p> <p>The quick <strong>brown</strong> fox jumped over the <em>lazy</em> dogs. 1. one 1. two 4. three 17. four</p> <p>So apparently, IE is stripping the breaks in my markdown code and just converting them to spaces. When I do a view source of the original code (prior to the script running), the breaks are there inside the container DIV.</p> <p>What am I doing wrong?</p> <p><strong>UPDATE</strong></p> <p>It is caused by the IE innerHTML/innerText "quirk" and I should have mentioned before that this one on an ASP.Net page using data bound controls - there are obviously a lot of different workarounds otherwise.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload