• I just installed SyntaxHighlighter Evolved – fabulous plugin. I’m having a couple problems, however.

    First, sometimes when I paste code into the visual editor (tinyMCE) in WordPress and save, it changes the paragraph style to Preformatted. Switching between Visual and HTML view doesn’t show any differences between the code. I find this rather disconcerting. What is it doing exactly? I coudn’t find any discussion on this at all, either on the plugin page on ww.wp.xz.cn or on the author’s plugin page.

    Second, I’m trying to blog about this plugin, but I can’t figure out how to insert square brackets along with the shortcodes. When I use &# 91; and &# 93; (with no spaces, of course) and switch between Visual and HTML view, it converts them to [ and ] respectively. If I can’t use the character code, how do I prevent WordPress from treating it like a shortcode?

    Thanks,
    David

    http://ww.wp.xz.cn/extend/plugins/syntaxhighlighter/

Viewing 9 replies - 1 through 9 (of 9 total)
  • My plugin purposely wraps your posted code in a <pre> tag. It helps TinyMCE to avoid screwing it up as it likes to do.

    A trick of WordPress is to double up on the shortcodes. For example writing [[gallery]] should end up as just [gallery].

    You can also do this ugly trick: [<strong></strong>gallery]

    Thread Starter davidpotter

    (@davidpotter)

    Hmm, doubling up brackets doesn’t work for me. The visual editor changes this:

    [sourcecode language="css"]
    your code here
    [ /sourcecode]

    into this (without the leading space before the / above):

    [
    [sourcecode language="css"]]
    your code here
    [[/sourcecode]
    
    ]

    It also gets messed up when I attempt to insert <strong></strong>. I even tried saving it from HTML mode without transitioning to Visual mode. It just won’t display properly using either of these tricks.

    It’s not clear to me how to do this so it works. I’d be especially happy if the first one worked, although I could live with the second one working. Do either of these tricks work for you with this plugin?

    Note 1: Interestingly enough, neither of these tricks work on this forum either.

    Note 2: What I find disconcerting is that when I use the features of this plugin I can no longer go to HTML mode to see what will actually be saved.

    Update: The <strong></strong> trick works partially. I was improperly using a combination of the two. The result of using this trick is an extra space.

    Oh, I completely forgot. Just do this:

    [text][css]foo[/css][/text]

    You can even do this I think:

    [code lang="php][php]<?php echo 'Hello world!'; ?>[/php][/code]

    By wrapping what you want to post in a different shortcode, it’ll work fine. My plugin won’t process it’s shortcodes inside it’s own shortcodes.

    Note 1: Interestingly enough, neither of these tricks work on this forum either.

    This forum isn’t running WordPress or my plugin. πŸ˜‰ Double brackets are the alias for linking to the Codex (wiki-style).

    Thread Starter davidpotter

    (@davidpotter)

    I could have sworn that I tried that. Thanks. That works.

    How do I get it to selectively not display the alternating color? I’m using the default style and for some code (e.g. the above example) I’d like to have it display the text without the gray background on every other line.

    Thanks,
    David

    Update: It doesn’t always work. Check this out. This:

    [ text light="true"][ text]Fatal error occurred when blah blah blah[ /text][ /text]

    gets translated by the visual editor to this:

    [ text light="true" wraplines="true"][ text light="true"]Fatal error occurred when blah blah blah[ /text]
    
    [ /text]

    (without the extra spaces, of course).

    As I mentioned above, you have to use different shortcodes, otherwise WordPress thinks the first closing tag (for the second opening tag) is meant for the first opening tag.

    As for the line coloring, that’s done by CSS.

    Thread Starter davidpotter

    (@davidpotter)

    Okay, so there’s no way to escape the [text] shortcode using the [text] shortcode, basically because there’s no way to escape brackets. Oh well. I suppose that’s a small compromise for an otherwise terrific plugin.

    See my review of it here:

    http://davidstechtips.com/2010/06/syntaxhighlighter-evolved-wordpress-plugin/

    Thanks for your help!

    [code][text]hi[/text][/code]

    Alex/Viper – brilliant! I am documenting something about the gallery shortcode and was racking my brain to find a way to escape it and nothing worked. Find it hard to believe others writing help files in blogs would not have raised this as an issue. Your suggestion for using [<strong></strong>gallery] worked like a charm.

    Many thanks!!

    Alex/Viper – brilliant! I am documenting something about the gallery shortcode and was racking my brain to find a way to escape it and nothing worked. Find it hard to believe others writing help files in blogs would not have raised this as an issue. Your suggestion for using [<strong></strong>gallery] worked like a charm.

    Many thanks!!

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

The topic ‘SyntaxHighlighter Evolved interaction with tinyMCE’ is closed to new replies.