PHP Classes

File: public/js/app/services/Highlight.class.js

Recommend this page to a friend!
  Classes of Sergey Beskorovayniy   Silex MVC Blog   public/js/app/services/Highlight.class.js   Download  
File: public/js/app/services/Highlight.class.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Silex MVC Blog
MVC based blog using on the Silex micro-framework
Author: By
Last change: Add TodoMVC for Vue.js
Date: 8 years ago
Size: 1,289 bytes
 

Contents

Class file image Download
define(['jquery'], function ($) { /** * Highlight - Syntax highlighting for the Web * * * JavaScript * * @author Sergii Beskorovainyi <bsa2657@yandex.ru> * @license MIT <http://www.opensource.org/licenses/mit-license.php> * @link https://github.com/bsa-git/silex-mvc/ */ var Highlight = Class.extend({ init: function (params) { try { this.params = params || {}; // Change class name // class = "language-yaml" => class = "yaml" $('pre code').each(function (i, block) { var c = $(block).attr("class"); if(c){ c = c.replace("language-","") $(block).attr("class", c); } }); // Set new configure hljs.configure(this.params); // Applies highlighting to all <pre><code>..</code></pre> blocks on a page. hljs.initHighlighting(); } catch (ex) { if (ex instanceof Error) { app.sys.onFailure(ex.name + ": " + ex.message); } } } }); return Highlight; });