Title: Compatibility with markdown generated ?
Last modified: April 10, 2024

---

# Compatibility with markdown generated ?

 *  [Terence Eden](https://wordpress.org/support/users/edent/)
 * (@edent)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/compatibility-with-markdown-generated/)
 * Brilliant plugin! One small question. I write using markdown and the official
   WordPress tooling changes:
 *     ```wp-block-code
       `php
       $a = 1;
       </code>`
       ```
   
 * Into:
 *     ```wp-block-code
       <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](https://wordpress.org/support/users/edent/)
 * (@edent)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/compatibility-with-markdown-generated/#post-17623478)
 * For those looking, this appears to do the trick:
 *     ```wp-block-code
       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 2 years, 1 month ago by [Terence Eden](https://wordpress.org/support/users/edent/).

Viewing 1 replies (of 1 total)

The topic ‘Compatibility with markdown generated ?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-geshi-highlight_8a7079.svg)
 * [WP-GeSHi-Highlight — rock-solid syntax highlighting for 259 languages](https://wordpress.org/plugins/wp-geshi-highlight/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-geshi-highlight/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-geshi-highlight/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-geshi-highlight/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-geshi-highlight/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-geshi-highlight/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [Terence Eden](https://wordpress.org/support/users/edent/)
 * Last activity: [2 years, 1 month ago](https://wordpress.org/support/topic/compatibility-with-markdown-generated/#post-17623478)
 * Status: not resolved