WordPress.org

Ready to get started?Download WordPress

Forums

SyntaxHighlighter Evolved
[Feature Request] on-demand javascript incl (4 posts)

  1. Volly
    Member
    Posted 3 years ago #

    Hi,
    i looked at the code and i think there is the possibility to improve the load-behavior of the scripts.
    The adding of scripts is momentary done in the constructor of SyntaxHighlighter. If its done in (i think) "shortcode_callback" it should only loads on the sites that really use the syntaxhighlighting feature.

    It also would be nice to have an option to choose the brushes that are really needed (i for myself only use the php-brush).

    I know, so many wishes and so less time ;-). If you need any help, feel free to ask.

    http://wordpress.org/extend/plugins/syntaxhighlighter/

  2. Alex Mills (Viper007Bond)
    Moderator
    Plugin Author

    Posted 3 years ago #

    If you take a look at the HTML source of your site, you'll find my plugin already does this. ;)

    wp_register_script() is not the same thing as wp_enqueue_script(). The register one only declares it's existence, it does not queue it up for outputting.

    The shortcode callback logs which languages are used into an internal variable and then a function hooked into the footer if your site outputs any needed Javascript files based on the content of that internal variable.

  3. Volly
    Member
    Posted 3 years ago #

    Thanks for the response,
    seems i skipped that while reading the code.

    In my theme the code is included on all sites - but the plugin proplably working correct. I load the last blog-posts in an footerarea and even the code is not rendered, i think the shortcode will be applied.

  4. Alex Mills (Viper007Bond)
    Moderator
    Plugin Author

    Posted 3 years ago #

    As long as the shortcode filter runs, the JS/CSS will get outputted. My plugin can't know that you don't end up displaying it. :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic