';
+ }
+ var reallang = lang.replace('=', '');
+ var languages = hljs.listLanguages();
+ if (languages.indexOf(reallang) == -1) {
+ var result = hljs.highlightAuto(code);
+ } else {
+ var result = hljs.highlight(reallang, code);
+ }
+ if (/\=$/.test(lang)) {
+ var lines = result.value.split('\n');
+ var linenumbers = [];
+ for (var i = 0; i < lines.length; i++) {
+ linenumbers[i] = "
" + (i + 1) + "
";
+ }
+ var linegutter = "
" + linenumbers.join('\n') + "
";
+ result.value = "
" + linegutter + "
" + result.value + "
";
+ }
+ return result.value;
+}
+
+emojify.setConfig({
+ img_dir: '/vendor/emojify/images',
+ ignore_emoticons: true
+});
+
+var md = new Remarkable('full', {
+ html: true,
+ linkify: true,
+ typographer: true,
+ highlight: highlightRender
+});
+//youtube
+var youtubePlugin = new Plugin(
+ // regexp to match
+ /{%youtube\s*([\d\D]*?)\s*%}/,
+
+ // this function will be called when something matches
+ function (match, utils) {
+ var videoid = match[1];
+ if (!videoid) return;
+ var div = $('');
+ setSizebyAttr(div, div);
+ div.attr('videoid', videoid);
+ var icon = '';
+ div.append(icon);
+ var thumbnail_src = '//img.youtube.com/vi/' + videoid + '/hqdefault.jpg';
+ div.css('background-image', 'url(' + thumbnail_src + ')');
+ return div[0].outerHTML;
+ }
+);
+//vimeo
+var vimeoPlugin = new Plugin(
+ // regexp to match
+ /{%vimeo\s*([\d\D]*?)\s*%}/,
+
+ // this function will be called when something matches
+ function (match, utils) {
+ var videoid = match[1];
+ if (!videoid) return;
+ var div = $('');
+ setSizebyAttr(div, div);
+ div.attr('videoid', videoid);
+ var icon = '';
+ div.append(icon);
+ return div[0].outerHTML;
+ }
+);
+//gist
+var gistPlugin = new Plugin(
+ // regexp to match
+ /{%gist\s*([\d\D]*?)\s*%}/,
+
+ // this function will be called when something matches
+ function (match, utils) {
+ var gistid = match[1];
+ var code = '';
+ return code;
+ }
+);
+//mathjax
+var mathjaxPlugin = new Plugin(
+ // regexp to match
+ /^\$\$\n([\d\D]*?)\n\$\$$|\$([\d\D]*?)\$/,
+
+ // this function will be called when something matches
+ function (match, utils) {
+ //var code = $(match).text();
+ return '' + match[0] + '';
+ }
+);
+md.use(youtubePlugin);
+md.use(vimeoPlugin);
+md.use(gistPlugin);
+md.use(mathjaxPlugin);
\ No newline at end of file
--
cgit v1.2.3