• Resolved RUSTAM JAFARSKY

    (@rustamjafarsky)


    Hello, Pierre-Henri Lavigne and the community.

    My post, written in Markdown, renders the syntax perfectly in preview mode, the screenshot below.

    However, when I publish the post, some of my content is treated as HTML and doesn’t appear at all.

    ACF turned on, screentshot below.

    ACF turned off, screenshot below.

    Here’s my single.php template code.

    <?php get_header();?>
    <p><button onclick="location.href='<?php echo home_url();?>'">HOME ๐Ÿ </button>
    <button onclick="history.back()">BACK ๐Ÿ”™</button>
    <!-- history.back() to be improved -->
    </p>
    <!-- <h1>This is a SINGLE.php for EN NOTES & BLOGS -->
    <div class="cont">
    this is SINGLE.php file
    <?php if( have_posts() ): while( have_posts() ): the_post();?>
    <?php echo the_content();?>
    <?php endwhile; else: endif;?>
    </div>
    <?php get_footer();?>

    Here’s my header.php template.

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- REMOVES SAFARI PHONE NUMBER DETECTION -->
    <meta name="format-detection" content="telephone=no">
    <title>๐ŸŒ RUSTAM JAFARSKY</title>
    </head>
    <body>
    <header>
    <p>IN THE NAME OF GOD, THE MOST GRACIOUS, THE MOST MERCIFUL</p>
    <?php wp_head();?>
    <hr/>
    <?php get_search_form();?>
    </header>

    I would like the published version of the post to match the content shown in the preview.

    Thank you very much.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Pierre-Henri Lavigne

    (@peter202202)

    Hello @rustamjafarsky ๐Ÿ‘‹

    Thank you for using Markup Markdown and welcome on board ๐Ÿคฒ

    To answer your question, and sorry if I sound rude, the published version is the correct rendering๐Ÿ‘Œ

    The preview mode is a quick rendering of the markdown code generated via JavaScript but WordPress filters are not applied at this stage. It’s far from being perfect I admit, the “preview” mode is mostly accurate and appreciated by people thanks to this live rendering (Possible via the sidebar / column mode). That’s the main point. I already spent a great amount of time to make the media part working, and if I had to apply PHP filters I would have to do something “async”. (Not live). So I don’t plan to modify the HTML rendering / default filters. ๐Ÿ™

    As you understand, everything between the “<” and “>” characters will be parsed as HTML tags. Using the escape character will not change anything as WordPress has its own filter on top of the plugin. Your custom html tags will be stripped (completely removed) or in the best case rendered as custom HTML (<this></this). I don’t know what you are trying to achieve, I would just advise you to use spaces around the ” < ” or ” > ” character as a workaround to avoird triggering HTML tags.

    About the backtick I don’t know why you are trying to escape it as it is used to mark code snippets by default. I haven’t tested but the backslash character might work for any other characters because this does not interfere with HTML rendering. (Just texte nodes)

    If you want pure markdown with advanced level options, other CMS might better work for you depending on what you are trying to do. (jekyll, etc…) With WordPress as the content manager, you can always expect a few side effects no offenses. ๐Ÿคฒ

    I hope I answer your question and that you will find a workound.

    Plugin Author Pierre-Henri Lavigne

    (@peter202202)

    @rustamjafarsky After digging a bit more, it might be possible but I can’t guarantee to make it with the next release. Please wait a few more days / weeks and I will get back to you if I get something working.

    Kind regards

    Thread Starter RUSTAM JAFARSKY

    (@rustamjafarsky)

    Thank you very much, @peter202202, for your reply and for digging into the problem that occured. I really appreciate all the hard work you put into maintaining the plugin and responding to all the queries in this forum.

    Iโ€™ll also try out the workaround you mentioned.

    Best regards.

    Plugin Author Pierre-Henri Lavigne

    (@peter202202)

    Thank you for your kind words @rustamjafarsky ๐Ÿคฒ Markdown for the best ๐ŸŽธ

    After diving into this issue, I actually solved another bug with block filters ๐ŸŒž
    Please upgrade to version 3.20.0 when you can, and then from the settings screen
    /wp-admin/options-general.php?page=markup-markdown-admin
    there should be a new option called “Super Backslash” that you need to turn off first ๐Ÿ˜‰

    Please give it a try when you can, that works on my localhost with the snippet your provided.
    It’s an optional feature to make \ character espacing super, greater and brackets signs used by WordPress for HTML tags and shortcode rendering.

    Kind regards

    Thread Starter RUSTAM JAFARSKY

    (@rustamjafarsky)

    @peter202202, Iโ€™ve tried the new version of your plugin, and it works as expected. Your solution perfectly solves the issue I described, making me want to edit text in your editor even more. Thank you very much!

    I also wish you all the best in fixing and improving your plugin. As I mentioned earlier, your contributions to this forum are amazing, and they will definitely pay off by making this plugin the best out there.

    Best regards.

    Plugin Author Pierre-Henri Lavigne

    (@peter202202)

    Thank you for your kind words @rustamjafarsky and glad that it works for you ๐Ÿš€

    I appreciate, can’t make everyone happy but hope as you said that it will pay off on the long run ๐Ÿคฒ

    Wish you a wonderful markdown journey

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Escaping characters with backslash.’ is closed to new replies.