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

Closed
anthonyalberto opened this Issue Sep 24, 2012 · 4 comments

Comments

Projects
None yet
5 participants

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

My blog is there : http://aarails.com

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.

Thanks!

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.

Collaborator

stephenh1988 commented Jan 21, 2013

As requested here and in http://wordpress.org/support/topic/prettify-code-not-working-in-some-views - 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 ?

Owner

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