You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>
The text was updated successfully, but these errors were encountered:
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?
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.
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:
The text was updated successfully, but these errors were encountered: