Is there a way to highlight code on the index page? #6

anthonyalberto opened this Issue Sep 24, 2012 · 4 comments


None yet
5 participants

Hello, following my comment on StackOverflow, I'm posting my question here :

My blog is there :

Is there a way to "prettify" code on the index page? For some reason, the markdown JS code isn't included on this page. But everything works fine on the article page.

Is there maybe a wordpress filter I can add to the plugin code to make it include the markdown JS on this page too?

Any help is appreciated, thanks!

Also on the board on this one.
Would be outstanding if it could display highlighted code on the homepage.


Did a small hack.

In wp-markdown.php, function loadPrettify(),

add || is_home() after return is_singular($savedtypes), like this:

function loadPrettify(){
    // ...... existing code

    return is_singular($savedtypes) || is_home();

By doing this, prettify.js will be also loaded on "home page" so that the code block will get formatted by prettify.js.

Maybe there should be an option in the settings to enable people who want this to get this function.


stephenh1988 commented Jan 21, 2013

As requested here and in - I'm marking this for 1.2 (next release).

If anyone wants to do a PR - feel free - but I'm looking for something which will only load the javascript when its needed!

On a completely unrelated note, what are people's opinions on #5 ?


stephenharris commented Mar 30, 2013

Sorry for the wait on this one. This is finally fixed with f8acd3e - I will leave it a bit before pushing to the WP repository so that any bugs came be spotted and fixed before then. Feel free to test it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment