• Brilliant plugin! One small question. I write using markdown and the official WordPress tooling changes:

    `php
    $a = 1;
    </code>`
    

    Into:

    <pre><code class="language-php">
    $a = 1;
    </code></pre>

    Is there any way to get the preg_replace_callback to detect that?

Viewing 1 replies (of 1 total)
  • Thread Starter Terence Eden

    (@edent)

    For those looking, this appears to do the trick:

    return preg_replace_callback(
            "/\s*<code(?:class=[\"']language\-([\w-]+)[\"']|line=[\"'](\d*)[\"']"
            ."|escaped=[\"'](true|false)?[\"']|cssfile=[\"']([\S]+)[\"']|\s)+>".
            "(.*)<\/code>\s*/siU",
            "wp_geshi_store_and_substitute",
            $s
    );
    

    You may also need to manually set $escaped = true; later in the file.

    • This reply was modified 7 months, 2 weeks ago by Terence Eden.
Viewing 1 replies (of 1 total)
  • The topic ‘Compatibility with markdown generated ?’ is closed to new replies.