WordPress.org

Ready to get started?Download WordPress

Forums

Crayon Syntax Highlighter
Incompatible with BlogText (2 posts)

  1. harrysummer
    Member
    Posted 5 months ago #

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

    [crayon-5335604d8da5a285775964/]

    If turning off BlogText, crayon becomes ok.

    https://wordpress.org/plugins/crayon-syntax-highlighter/

  2. harrysummer
    Member
    Posted 5 months 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

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.