WordPress.org

Support

Support » Plugins and Hacks » SyntaxHighlighter Evolved » [Plugin: SyntaxHighlighter Evolved] URLs auto-linked in comments before being highlighted

[Plugin: SyntaxHighlighter Evolved] URLs auto-linked in comments before being highlighted

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Alex Mills (Viper007Bond)

    @viper007bond

    Yeah, known issue. 🙁

    Technically they’re being hyperlinked AFTER the shortcode is processed, not before, but it doesn’t really matter as the result is the same. The Javascript shows the HTML source.

    make_clickable() isn’t smart enough to not touch stuff inside of pre tags.

    Mike Adams wrote a patch for me that uses some placeholders to get around this issue, I just haven’t had time to massage the patch and commit it.

    Well, I’d be happy to help test or tweak the patch. Let me know.

    Are there any updates on this? I’m having the same issue in the latest version.

    This is my current workaround. I haven’t tested it extensively though.

    function _make_clickable_mod_callback($matches)
    {
        global $_make_clickable_placeholders;
        $key = '{{TMP-' . uniqid('', true) . '}}';
        $_make_clickable_placeholders[$key] = $matches[0];
        return $key;
    }
    
    function make_clickable_mod($text)
    {
        global $_make_clickable_placeholders;
        $_make_clickable_placeholders = array();
        $text = preg_replace_callback('#<pre.*>.*</pre>#imsuU', '_make_clickable_mod_callback', $text);
        $text = make_clickable($text);
        $text = str_replace(array_keys($_make_clickable_placeholders), array_values($_make_clickable_placeholders), $text);
        return $text;
    }
    
    remove_filter('comment_text', 'make_clickable', 9);
    add_filter('comment_text', 'make_clickable_mod', 9);
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: SyntaxHighlighter Evolved] URLs auto-linked in comments before being highlighted’ is closed to new replies.
Skip to toolbar