HTML example stripped from Markdown code block.

  • Unknown's avatar

    I am editing a blog post using the new markdown support. But when I save a draft it is stripping HTML from my code examples.

    I have the following code snippet in my post.

    ` javascript
    (function(g) {
    ‘use strict’;

    var iframeHTML = [
    //doctype is important for good ol IE we dont want no quirks mode!
    ‘<!DOCTYPE html>’,
    ‘<html>’,
    ‘<head><head>’,
    ‘<body>’,
    ‘<script type=”text/javascript”>’,
    ‘<%= spxwScript %>’,
    ‘</script>’,
    ‘</body>’,
    ‘</html>’
    ].join(”);
    `

    When I save the draft it gets converted into:

    ` javascript
    (function(g) {
    ‘use strict’;

    var iframeHTML = [
    //doctype is important for good ol IE we dont want no quirks mode!
    “”,
    “”,
    “”,
    “”,
    “”,
    “”,
    “”,
    “”,
    “”
    ].join(”);
    `

    Is there any way to signal to WP that it shouldnt strip HTML or js from code blocks in markdown?

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    Hi there,

    I believe all of our various shortcodes have been implemented in to markdown, and if you are trying to display actual code as opposed to have the code operated on, the best way is usually to use the [sourcecode] shortcode.

    Here’s more information on it:

    http://en.support.wordpress.com/code/posting-source-code/

  • Unknown's avatar

    I am not using shortcodes. I am using the syntax highlighting defined in markdown according to your markdown documentation.

    Markdown Quick Reference Cheat Sheet

    Its stripping the html example from my javascript code block using the markdown syntax highlighting.

    I am not using the shortcodes because they are not standard markdown and markdown has support for code examples using syntax highlighting defined in your documentation link above.

  • Unknown's avatar

    Ah, I see what you’re speaking about. I’ve been looking in to this and have put it in front of our developers who have been implementing the markdown language into WordPress.com. As soon as I have additional information for you, I’ll let you know!

  • Unknown's avatar

    Woohoo Thanks so much! Is there a bug tracker or should I just watch this thread for updates?

  • Unknown's avatar

    There isn’t an externally-available bug tracker, I’m afraid. Either I or one of the folks who are attached to this project will let you know here when we’ve got something for you!

    Thanks for letting us know about this. We appreciate it! :)

  • The topic ‘HTML example stripped from Markdown code block.’ is closed to new replies.