Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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

anthonyalberto opened this issue Sep 24, 2012 · 4 comments
Milestone

Comments

@anthonyalberto
Copy link

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!

@frankielc
Copy link

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

Thanks!

@dantewang
Copy link

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
Copy link
Collaborator

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 ?

@stephenharris
Copy link
Owner

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants