Markdown is lost after saving post (can't re-edit markdown).

  • When a post is written in markdown, published and opened later on to edit, the markdown format is thoroughly replaced with HTML.

    This seems to be a bug, as I tested with random posts and some lost the markdown code in the first try, and others kept the markdown for a while and finally also lost the code translating everything to HTML.

    I was dedicated in my tests and used only the HTML editor all time. The visual editor works very badly with markdown code.

    Is this supposed to happen?

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

  • Yes your markdown code/post should remain un-converted within the post editor. I just tested this out quickly myself and was able to verify that my markdown written post was still un-modified after publish, and during auto-saves while drafting the post.

    I’m wondering if you might be using some additional markdown formatting that I did not use in my test post though. Would you mind sharing a link to the post, or some of the markdown text so I can test it out further?

  • Hi! Just reproduced the bug with the following steps (and I’m using markdown here in comments just for the fun of it):

    1. used my old blog “cyranodisse” to write a new post, although I noticed the bug while writing to another blog, “wfpcoe”;

    2. I wrote the following code using HTML editor:

    # markdown
    
    *just trying*
    
    see if it keeps code.
    
    1. one
    2. two
    3. three
    
    **that's it.**

    3. Saved the post as a draft and closed window;
    4. Opened again and opened the draft, which was still keeping markdown in place;
    5. Published it and closed window;
    6. Opened the post in blog and clicked on the “Edit” link;
    7. Editor showed me the post with HTML coding instead of markdown. It was all gone!
    8. I repeated the same steps using the Visual Editor to write the markdown, draft saved kept the markdown in place and the publish-view post-click on ‘edit’ link brought me the same result: markdown was gone and replaced by HTML; as expected, the visual editor was showing me the actual appearance of titles, italics and bold instead of the markdown code that originally generated them.

  • Sorry. I posted the reply using another account.

    Everything I said applies to my account “cyrano”.

  • Thank you for the detailed steps. I will do some more testing myself and see if I can re-create the issue. One last item – are you using the wp-admin editor, or the editor seen at https://wordpress.com/post ?

  • Hi Timmy, thanks a lot for your time.

    Honestly, it’s been ages since I last saw the wp-admin editor. So, yes, I have been using solely the one you linked in your reply.

    I don’t know if it’s clear in my steps, but in step “6” I opened the blog url, and as I’m logged in a “Edit” link appears in the bottom of the website. This is the link I used to edit the published markdown post and it always leads us to the https://wordpress.com/post editor.

    Actually I didn’t even know the wp-admin editor still existed, so I had to look around at wp-admin to find out how to reach this “old” editor and when I saw it I moved a few years back in time. :D

  • @cyrano – thanks for the verification on the editor. I am able to reproduce the issue and indeed the markdown should be retained/displayed when you subsequently edit a markdown post.

    Thanks for reporting this issue – I’m looking into a fix right now.

  • @cyrano okay that was fun to dig into. Turns out the bug had been reported before, my findings and the original bug thread is here if you are interested https://github.com/Automattic/wp-calypso/issues/2373#issuecomment-275513957

    We are evaluating a few fixes – but the work-around to ensure the post content stays in markdown is to always make an edit to the post content. Even if it is just adding a space, or a line return ( that will be stripped out eventually ) that will ensure the markdown logic has changed and will be sent to the server/API to be saved.

  • Great digging, Timmy, thanks! So, besides always avoiding the visual editor, I should always change something in the markdown post to be sure it won’t be converted, right?

    I agree with the comments on the bug thread. Nevertheless, these so specific steps are not that unlikely to happen if someone is working with several notes and drafts in their blogs *and* is a nerd fond of markdown. Of course, we are very few, just like code programmers are. ;)

    Cheers to all of you. The work-around sounds great for now!

  • Thanks for the workarounds!

    But if I read the bug thread correctly, MD is going away? If so, I will be disappointed.

  • @amateurlee can you send more feedback on that? We’ll be sure to send it along.

  • Tables, footnotes, definition lists, acronyms rock in Markdown. Especially tables and footnotes. Granted, neither is likely to be used in most posts, but when you need them the Markdown version keeps hair on your head.

  • Thank you. I’ll share that with our developers.

  • Hi @varunagrawal, we don’t have a fix in place yet but have been working through this. We’ll update here when we have more info.

  • The topic ‘Markdown is lost after saving post (can't re-edit markdown).’ is closed to new replies.