Skip to content

Commit

Permalink
fix(scripts): Fix not highlight without/invalid language
Browse files Browse the repository at this point in the history
  • Loading branch information
oswaldoacauan committed Nov 24, 2013
1 parent fa86976 commit 8ab9255
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/assets/js/scripts.js
@@ -1,4 +1,4 @@
/* global Drawer: false, ImageLoader: false, NProgress: false, Prism: false */
/* global ga:false, Drawer: false, ImageLoader: false, NProgress: false, Prism: false */
(function ($, window, document, undefined) {

'use strict';
Expand All @@ -23,8 +23,10 @@

var _prismHandler = function() {
$('code').not('[class*="language-"]').addClass(function() {
var _lang = $(this).attr('class');
return 'language-' + (_lang ? _lang : 'markup');
var _lang = $(this).attr('class') || 'markup';

_lang = _lang.replace(/(language|lang)+\-/gi, '');
return 'language-' + (Prism.languages.hasOwnProperty(_lang) ? _lang : 'markup');
});

Prism.highlightAll();
Expand Down Expand Up @@ -59,8 +61,8 @@
$document.pjax('a[data-pjax]', '[data-pjax-container]');

$document.on('submit', 'form[data-pjax]', function(e) {
$.pjax.submit(e, '[data-pjax-container]')
})
$.pjax.submit(e, '[data-pjax-container]');
});
}

// Data API bindings
Expand Down

0 comments on commit 8ab9255

Please sign in to comment.