# Support auto-highlighting for preformatted code

**URL:** <https://meta.discourse.org/t/support-auto-highlighting-for-preformatted-code/14234>\
**Category:** Feature\
**Created:** [Mars 28, 2014, 2:52 UTC](https://meta.discourse.org/t/support-auto-highlighting-for-preformatted-code/14234 "2014-03-28T14:52:10Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![lightyear](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@lightyear](https://meta.discourse.org/u/lightyear)\
**Post date:** [Mars 28, 2014, 5:53 UTC](https://meta.discourse.org/t/support-auto-highlighting-for-preformatted-code/14234/2 "2014-03-28T17:53:53Z")

</div>

Hey @Naatan,

we are using the custom `highlightBlock` feature to only have highlistjs render the code-parts of the markdown (see [https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/lib/syntax\_highlighting.js#L21](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/lib/syntax_highlighting.js#L21) ). Now from what I can read in the highlight.js’s source code, it internally does use the Auto-Mode if no language is specified. See line 512 in the `highlightBlock` function.

> <https://github.com/highlightjs/highlight.js/blob/main/src/highlight.js#L512>

Can you show us an example of where and when it doesn’t work but it does with the library outside of discourse? Then I’d gladly debug it, otherwise I’d say the request needs to go to highlightjs …

---

_[View the full topic](https://meta.discourse.org/t/support-auto-highlighting-for-preformatted-code/14234)._
