Crayon Syntax Highlighter
Incompatible with BlogText (2 posts)

  1. harrysummer
    Posted 2 years ago #

    I'm using both CrayonSyntaxHighlighter and BlogText. When I turn on BlogText, all crayon code becomes like this:


    If turning off BlogText, crayon becomes ok.


  2. harrysummer
    Posted 2 years ago #

    After some investigations, I found out that it is because of the caching of BlogText. The crayon code id is a uiqid() value determined by the time on the server. However, BlogText would cache a fixed id. So, crayon may not be able to find the source to replace the [crayon-xxxxx/] shortcode.

    I also feel Crayon a bit strange. It registers two hooks in processing the codes. The first one is "the_posts" filter, which processes all the posts everytime we load a page, convert tags into [crayon-xxx/] shortcode. And the second one "the_content" filter, which convert the shortcode into actual code. If any caching mechanism in the_content callback before crayon's the_content, crayon will be failed to look up the id.

    My workaround now is to disable the caching in blogtext, although may increase the overhead. It seems the only prossible fast solution by hand. I think the most reasonable solution should be replace the id generating of crayon by a deterministic method, e.g. MD5 on the code. This would make the id unchangeable with time, and compatible with any caching plugins

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Crayon Syntax Highlighter
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.