WordPress.org

Forums

Crayon Syntax Highlighter
Crayons inside TablePress cells (6 posts)

  1. victorwyee
    Member
    Posted 1 year ago #

    Hello! I would like to use Crayons inside TablePress table cells. I'm doing this by using the <pre> tag in the cells. However, it doesn't seem like Crayon Syntax Highlighter is recognizing or capturing these <pre> tags (when I inspect the output table, the<pre> tags are indeed there). CSH is working as normal for other <pre> tags in the same page (not post), so I don't think it's a loading issue (I've also tried unchecking the option to try not to load CSH when not needed).

    I've also tried using inline tags and code, to no avail.

    If I use Chrome's Inspector to move the entire compiled Crayon block (the one that's working outside of the TablePress table, but on the same page) into the TablePress table cell, the syntax-highlight content does show up correctly.

    Any advice? Thanks!!!

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

  2. TobiasBg
    Member
    Posted 1 year ago #

    Hi,

    thanks for your post, and sorry for the trouble.

    I'm not sure why the plugin is not picking up the content in the table cells, but you can try to force by adding this line to the "functions.php" in your theme:

    add_filter( 'tablepress_cell_content', 'CrayonWP::the_content' );

    Regards,
    Tobias

  3. victorwyee
    Member
    Posted 1 year ago #

    Hi Tobias! Thanks for such a quick reply! And thanks for such a wonderful plugin.

    Unfortunately, your suggestion doesn't seem to work. But it's OK; I'm putting code snippets in a TablePress table, and just thought it'd be nice (but not necessary) to have some highlighting.

    Thanks again!
    Victor

  4. TobiasBg
    Member
    Posted 1 year ago #

    Hi Victor,

    ok, that's strange. Then please also try this: Add another parameter to the Shortcode like

    [table id=123 cache_table_output=false /]

    If that also doesn't help, I'm out of ideas here :-(

    Regards,
    Tobias

  5. victorwyee
    Member
    Posted 1 year ago #

    Hi Tobias,

    Thanks for a second suggestion. Unfortunately, it didn't work either... :(

    Thanks again though!
    Victor

  6. TobiasBg
    Member
    Posted 1 year ago #

    Hi Victor,

    that's unfortunate. :-( I'm not sure what the Crayon plugin needs then :-( Sorry.

    Best wishes,
    Tobias

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