ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Code Highlighting

August 26, 2009 7:38am

Subscribe [3]
  • #1 / Aug 26, 2009 7:38am

    stevenkovar

    11 posts

    I’ve researched this in the forums, but I just can’t seem to figure it out. I don’t want my code blocks in entries to be highlighted due to the extra span tags. I’ve tried turning off code highlighting in the Typography file in the core folder, but then it processes EE code, even though it is in a blog entry, and wrapped with different combinations of normal HTML PRE and CODE tags.

    It’s my understanding that EE template code in entries is not supposed to be processed. I may be wrong?

    When I simply use

    [code]

    tags, the page validates, but I get strange breaks at the end of lines where the last character, usually a bracket or “>” breaks to the next line, which is visually disruptive.

    When I put the code within

    <pre>
    then
    [code]

    , it appears correctly, but no longer validates. I can live with the code highlighting, but would prefer that it validates. My ultimate goal is to remove highlighting altogether.

    Does anyone have any ideas? Thanks in advance.

  • #2 / Aug 26, 2009 12:06pm

    Sue Crocker

    26054 posts

    A link to the page in question would be handy.

  • #3 / Aug 26, 2009 12:09pm

    stevenkovar

    11 posts

  • #4 / Aug 26, 2009 7:49pm

    Greg Aker

    6022 posts

    I not totally sure what to do for this, my best guess would be to write a plugin or typography extension that will hijack the code area and convert all the HTML into entities and convert new line characters into <br />  Then you can wrap it in a pre or code tag.

    Or you can convert all the characters into the proper entities before you submit the entry.

    -greg

  • #5 / Aug 28, 2009 5:53am

    stevenkovar

    11 posts

    Thanks, Greg! I ended up just converting all of the code sections to entities.

  • #6 / Aug 28, 2009 11:08am

    Ingmar

    29245 posts

    That’s certainly a pragmatic solution in this instance. Please post again if you need additional help.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases