Merge pull request #2204 from ligthyear/fix-autohighlight

Enable autohighlighting of highlight.js for all code blocks
This commit is contained in:
Régis Hanol 2014-03-31 10:16:19 +02:00
commit 97da6e7bd7
3 changed files with 6 additions and 1 deletions

View file

@ -16,7 +16,8 @@ Discourse.SyntaxHighlighting = {
@param {jQuery.selector} $elem The element we want to apply our highlighting to
**/
apply: function($elem) {
$('pre code[class]', $elem).each(function(i, e) {
var selector = Discourse.SiteSettings.autohighlight_all_code ? 'pre code' : 'pre code[class]';
$(selector, $elem).each(function(i, e) {
return $LAB.script("/javascripts/highlight.pack.js").wait(function() {
return hljs.highlightBlock(e);
});

View file

@ -856,6 +856,7 @@ en:
short_progress_text_threshold: "After the number of posts in a topic goes above this number, the progress bar will only show the current post number. If you change the progress bar's width, you may need to change this value."
default_code_lang: "Default programming language syntax highlighting applied to GitHub code blocks (lang-auto, ruby, python etc.)"
warn_reviving_old_topic_age: "When someone starts replying to a topic older than this many days, a warning will be displayed to discourage the user from reviving an old discussion. Disable by setting to 0."
autohighlight_all_code: "Apply code highlighting to all preformatted code blocks even when the didn't specify the language"
embeddable_host: "Host that can embed the comments from this Discourse forum"
feed_polling_enabled: "Whether to import a RSS/ATOM feed as posts"

View file

@ -235,6 +235,9 @@ posting:
client: true
default: "lang-auto"
warn_reviving_old_topic_age: 180
autohighlight_all_code:
client: true
default: false
email:
email_time_window_mins: 10