Saving as HTML doesn't save fenced code blocks properly

Gabriel Ayuso's Avatar

Gabriel Ayuso

03 Jun, 2013 11:48 PM

In the attached screenshot you can se a markdown file with a fenced code block which is properly converted to Github styled HTML on Marked's HTML view but the same correct HTML isn't used when saving to an HTML file.

Top left: original markdown
Top right: Marked showing the markdown fenced code block being correctly represented as HTML.
Bottom left: Wrong HTML stored by Marked when saving
Bottom right: The saved HTML file opened in Chrome.

  1. Support Staff 1 Posted by Brett on 03 Jun, 2013 11:53 PM

    Brett's Avatar

    May I have an exact copy of the relevant portion of that file and a quick screenshot of your Behavior settings? Thanks!

    Sent from Mailbox for iPhone

  2. 2 Posted by Gabriel Ayuso on 03 Jun, 2013 11:59 PM

    Gabriel Ayuso's Avatar

    Thanks for the quick response.
    I have attached the screenshot of the Behavior settings and the markdown
    snippet.

    Regards,
    Gabriel Ayuso

  3. Support Staff 3 Posted by Brett on 04 Jun, 2013 12:22 AM

    Brett's Avatar

    I haven't been able to narrow it down yet, but I can definitely replicate the bug to some extent. It's even weirder on my end, though. I'll work to figure out why it's behaving differently on Save with that combination of settings.

    -Brett

  4. Support Staff 4 Posted by Brett on 04 Jun, 2013 05:20 PM

    Brett's Avatar

    I can't for the life of me figure out where it is, but there's a gremlin in the markdown you posted. If I retype the code by hand for just the first block, everything works again.

    Also note that there are two other issues:

    1. The colon in the first line can cause it to be recognized as MMD meta when it shouldn't, a blank line before a header like that will solve it. I know this was just a partial paste, just noting that.
    2. Code blocks should have newlines before and after them. I try to parse around that, but you'll get more consistent results if you're a little more liberal with whitespace.

    -Brett

  5. 5 Posted by Gabriel Ayuso on 04 Jun, 2013 05:35 PM

    Gabriel Ayuso's Avatar

    Thank you for the advice.
    Btw I took the liberty to test the export to DOCX of the beta version and
    it worked great, except for tables (probably not implemented yet).
    If you don't mind I'd like to keep using the beta. I'll provide feedback if
    I find any issues or suggestions.

    Regards,
    Gabriel Ayuso

  6. Support Staff 6 Posted by Brett on 04 Jun, 2013 05:38 PM

    Brett's Avatar

    Please do keep testing, let me know what you run into.

    DOCX export is shady at best. You get better results by exporting RTFD and pasting, or exporting HTML and importing, or exporting ODT, opening in OpenDoc and exporting DOCX. For some reason, going straight to DOCX has proven nearly impossible to get right.

Comments are currently closed for this discussion. You can start a new one.

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