Make autohighighting for all Code-Blocks a SiteSetting

This commit is contained in:
Benjamin Kampmann 2014-03-31 09:44:35 +02:00
parent fb70df3ff3
commit 2815e98e6d
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