SyntaxHighlighter Evolved
URLs auto-linked in comments before being highlighted (4 posts)

  1. Aaron D. Campbell
    Posted 4 years ago #

    If you take a look at comments like these:

    You can see that the URLs are getting linked BEFORE the sourcecode shortcode is being processed. This ends up messing up the code that's being posted. The workaround is to put a space after http so the URL isn't auto-linked, but obviously then the code isn't accurate.


  2. Alex Mills (Viper007Bond)
    Plugin Author

    Posted 4 years ago #

    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.

  3. Aaron D. Campbell
    Posted 4 years ago #

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

  4. Dave James Miller
    Posted 4 years ago #

    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);

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • SyntaxHighlighter Evolved
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic