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

Directive should apply highlights to child pre/code tags #34

Open
TheEvilDev opened this issue Nov 23, 2014 · 2 comments
Open

Directive should apply highlights to child pre/code tags #34

TheEvilDev opened this issue Nov 23, 2014 · 2 comments

Comments

@TheEvilDev
Copy link

Hey,

Maybe there's a way to get it to do this already, but it would be great if I could tell this to apply the highlight only to the nested code/pre tags.

For example, I have a section that pulls in a blog post dynamically:

<div ng-repeat="post in posts">
    <section hljs ng-include="post.href">
           <!-- Don't want everything in here to be treated as a code block and highlighted, just want to apply the directive to code blocks added in here -->
    </section>
</div>
@pc035860
Copy link
Owner

Hi @TheEvilDev ,

hljs should always follow where code goes. If you have a blog post around your code, you shouldn't apply it on the post level HTML tag (which is <section> in your example).

Can you try adding hljs directive directly to the code blocks in the posts?
Or there are some reasons stop you from doing so?

@TheEvilDev
Copy link
Author

Hey,

Yeah, I understand why it's setup the way it is. In my use case this will not work, as my posts are all markdown, and I prefer to keep them clean of markup as much as possible (to be easy and quick to write). The entire post gets loaded into the page, and it applies the highlights on load.

I ended up writing my own directive for this, it was fairly trivial just working with highlight-js, but would have been cool to take advantage of this project.

Just a thought, having an optional setting would be a nice to have feature.

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

2 participants