Using Syntaxhighlighter

  • Unknown's avatar

    From what I’ve read, I assume that syntaxhighlighter evolved is built into wordpress.com. So If I ask to post a blog, I can paste the following into the visual tab

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

    and it will display the code I add highlighted appropriately when I hit the preview button. But it doesn’t.

    What am I missing?

    I’m new to wordpress, but this is something I want to use consistently.

    Thanks in advance.

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    It works for me. Did you put the sourcecode shortcode and code in while in the HTML tab in the editor? Take a look at one of my test blogs for a sample. The following is what I put into the HTML tab in the editor.

    [sourcecode language="css"]
    #widgets {
    background: none repeat scroll 0 0 transparent;
    margin-left: 950px;
    position: absolute;
    top: 20px;
    width: 200px;
    }
    [/sourcecode]
  • Unknown's avatar

    In the HTML view I didn’t use " So this helps. At the same time, there is no highlighting in what I see? No box. No line numbers. What is wrong?

    Also, when you say look at your test blogs. What am I supposed to look at? I see the results, but I don’t see what must be added to create those results.

    Thanks in advance.

  • Unknown's avatar

    On the site linked to your username, there are no posts or anything except for the default stuff. http://packersfalls.wordpress.com/

    If you are talking about a different site we need a link to it.

    Also nothing will show up in the editor if that is what you are expecting. It may or may not show up when you preview from the editor page. The preview has been less than a stellar performer lately.

    What I added is what I posted above in the light grey block.

  • Unknown's avatar

    I finally published it (rather than using preview). It still looks like plain text.

    I give up.

    Anyways, thanks for your help.

  • Unknown's avatar

    I’m not sure what you are doing wrong. What I see on your site looks as if the sourcecode tags have been stripped out since when I view source it is just wrapped in “p” tags.

    I thought perhaps it was the theme, but I did another test after switching to the theme you are using and again it shows up just fine on my site.

    http://flippintestblog.wordpress.com/2011/08/18/another-sourcecode-test/

    Are you by chance copying and pasting the sourcecode tags from somewhere? If so that can mess things up. Always type them in.

    Copy the following and paste it into the HTML tab on a post and see what happens.

    [sourcecode language="css"]
    #sidebar {
    margin-left: 650px;
    }
    
    .hentry {
    padding-left: 100px;
    }
    
    .datebox {
    left: 32px;
    }
    
    #credit {
    bottom: 0;
    left: 100px;
    position: relative;
    }
    
    #widgets, #footer {
    margin-left: 100px;
    }
    [/sourcecode]
  • Unknown's avatar

    @thesacredpath, I was curious about this syntax highlighting package as well and your post worked perfectly on my test blog post. Thanks!

  • The topic ‘Using Syntaxhighlighter’ is closed to new replies.