switch editor from mdedit to simplemde
This commit is contained in:
parent
00d17efe0f
commit
3a114eaa11
|
@ -103,28 +103,24 @@
|
|||
}
|
||||
|
||||
/* special styling to make editor subtle and fit the window */
|
||||
#app-content pre {
|
||||
display: block;
|
||||
.CodeMirror {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
width: 100%;
|
||||
max-width: 47em;
|
||||
margin: 0 0 -50px;
|
||||
padding: 30px 20px 90px 30px;
|
||||
font-size: 16px;
|
||||
line-height: 170%;
|
||||
background: none;
|
||||
resize: none;
|
||||
box-sizing: border-box;
|
||||
font-family: inherit;
|
||||
margin: 0 0 -50px;
|
||||
padding: 30px 0 90px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#app-content .note-meta {
|
||||
position: relative;
|
||||
padding: 0 45px 30px 45px;
|
||||
margin: -10px 0 0;
|
||||
opacity: .2;
|
||||
-ms-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
#app-content .saving {
|
||||
|
@ -137,65 +133,61 @@
|
|||
|
||||
/* markdown styling */
|
||||
|
||||
.mdedit .heading {
|
||||
.CodeMirror .CodeMirror-code .cm-header {
|
||||
/* break from core in using semibold, otherwise not emphasized in texts */
|
||||
font-weight: 600;
|
||||
}
|
||||
.mdedit .heading.heading-1 {
|
||||
.CodeMirror .CodeMirror-code .cm-header-1 {
|
||||
font-size: 40px;
|
||||
margin: 50px 0 20px;
|
||||
line-height: 120%;
|
||||
}
|
||||
.mdedit .heading.heading-2 {
|
||||
.CodeMirror .CodeMirror-code .cm-header-2 {
|
||||
font-size: 20px;
|
||||
margin-top: 12px;
|
||||
line-height: 150%;
|
||||
}
|
||||
.mdedit .heading.heading-3,
|
||||
.mdedit .heading.heading-4,
|
||||
.mdedit .heading.heading-5,
|
||||
.mdedit .heading.heading-6 {
|
||||
.CodeMirror .CodeMirror-code .cm-header-3,
|
||||
.CodeMirror .CodeMirror-code .cm-header-4,
|
||||
.CodeMirror .CodeMirror-code .cm-header-5,
|
||||
.CodeMirror .CodeMirror-code .cm-header-6 {
|
||||
font-size: 16px;
|
||||
margin: 0;
|
||||
font-weight: 300;
|
||||
}
|
||||
.mdedit .heading.heading-3 {
|
||||
.CodeMirror .CodeMirror-code .cm-header-3 {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.mdedit .hr {
|
||||
.CodeMirror .CodeMirror-code .cm-hr {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
margin: .5em 0;
|
||||
}
|
||||
.mdedit .hr-marker {
|
||||
background-color: white;
|
||||
}
|
||||
.mdedit .hr-marker:last-child {
|
||||
padding-right: 10px;
|
||||
}
|
||||
.mdedit .hr:before {
|
||||
|
||||
.CodeMirror .CodeMirror-code .cm-hr:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
top: 50%;
|
||||
width: 100%;
|
||||
z-index: -1;
|
||||
border-top: 1px solid rgba(120, 120, 120, 0.5);
|
||||
border-top: 5px solid rgba(120, 120, 120, 0.2);
|
||||
}
|
||||
|
||||
|
||||
/* hanging punctuation */
|
||||
#app-content .mdedit {
|
||||
.CodeMirror .CodeMirror-code .CodeMirror-line {
|
||||
padding-left: 45px;
|
||||
display: inline-block;
|
||||
}
|
||||
.mdedit > div > .token > .heading-hash,
|
||||
.mdedit > div > .token > .li > .list-item,
|
||||
.mdedit > div > .token > .quote-marker {
|
||||
width: 90px;
|
||||
margin-left: -90px;
|
||||
|
||||
.CodeMirror .CodeMirror-code .cm-formatting-header:not(:only-child),
|
||||
.CodeMirror .CodeMirror-code .cm-formatting-list,
|
||||
.CodeMirror .CodeMirror-code .cm-formatting-quote {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
width: 90px;
|
||||
margin-top: 0;
|
||||
margin-left: -90px;
|
||||
text-align: right;
|
||||
white-space: pre;
|
||||
}
|
||||
|
@ -204,7 +196,7 @@
|
|||
/* larger screen sizes */
|
||||
@media only screen and (min-width: 769px) {
|
||||
/* use slightly more space on the left so all # signs of h3–h6 show */
|
||||
#app-content .mdedit,
|
||||
.CodeMirror .CodeMirror-code .CodeMirror-line,
|
||||
#app-content .note-meta {
|
||||
padding-left: 90px;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
app.controller('NoteController', function($routeParams, $scope, NotesModel,
|
||||
SaveQueue, note) {
|
||||
SaveQueue, note, debounce) {
|
||||
'use strict';
|
||||
|
||||
NotesModel.updateIfExists(note);
|
||||
|
@ -22,9 +22,9 @@ app.controller('NoteController', function($routeParams, $scope, NotesModel,
|
|||
t('notes', 'New note');
|
||||
};
|
||||
|
||||
$scope.save = function() {
|
||||
$scope.save = debounce(function() {
|
||||
var note = $scope.note;
|
||||
SaveQueue.add(note);
|
||||
};
|
||||
}, 300);
|
||||
|
||||
});
|
|
@ -1,23 +1,30 @@
|
|||
/*global mdEdit*/
|
||||
/*global SimpleMDE*/
|
||||
app.directive('editor', ['$timeout', function ($timeout) {
|
||||
'use strict';
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function(scope, element) {
|
||||
var editor = mdEdit(element[0], {change: function(value) {
|
||||
$timeout(function(){
|
||||
scope.$apply(function() {
|
||||
scope.note.content = value;
|
||||
|
||||
var simplemde = new SimpleMDE({
|
||||
element: element[0],
|
||||
spellChecker: false,
|
||||
autoDownloadFontAwesome: false,
|
||||
toolbar: false,
|
||||
status: false,
|
||||
forceSync: true
|
||||
});
|
||||
var editorElement = $(simplemde.codemirror.getWrapperElement());
|
||||
|
||||
simplemde.value(scope.note.content);
|
||||
|
||||
simplemde.codemirror.on('change', function() {
|
||||
$timeout(function() {
|
||||
scope.$apply(function () {
|
||||
scope.note.content = simplemde.value();
|
||||
scope.save();
|
||||
scope.updateTitle();
|
||||
});
|
||||
});
|
||||
}});
|
||||
editor.setValue(scope.note.content);
|
||||
element.on('click', '.link', function(event) {
|
||||
if(event.ctrlKey) {
|
||||
var url = $(this).find('.link-params-inner').text();
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2013, Bernhard Posselt <dev@bernhard-posselt.com>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING file.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Like ng-change only that it does not fire when you type faster than
|
||||
* 300 ms
|
||||
*/
|
||||
app.directive('notesTimeoutChange', function ($timeout) {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function (scope, element, attributes) {
|
||||
var interval = 300; // 300 miliseconds timeout after typing
|
||||
var timeout;
|
||||
|
||||
$(element).bind('input propertychange paste', function () {
|
||||
$timeout.cancel(timeout);
|
||||
|
||||
timeout = $timeout(function () {
|
||||
scope.$apply(attributes.notesTimeoutChange);
|
||||
}, interval);
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* Copyright (c) 2016, Hendrik Leppelsack
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING file.
|
||||
*/
|
||||
|
||||
app.factory('debounce', ['$timeout', function($timeout) {
|
||||
'use strict';
|
||||
|
||||
return function debounce(func, delay) {
|
||||
var timeout;
|
||||
|
||||
return function() {
|
||||
var context = this, args = arguments;
|
||||
|
||||
if(timeout) {
|
||||
$timeout.cancel(timeout);
|
||||
}
|
||||
timeout = $timeout(function() {
|
||||
func.apply(context, args);
|
||||
}, delay);
|
||||
};
|
||||
};
|
||||
}]);
|
|
@ -9,6 +9,6 @@
|
|||
"angular-mocks": "1.4.*",
|
||||
"angular-route": "1.4.*",
|
||||
"prism": "~1.0.1",
|
||||
"mdEdit": "https://github.com/jbt/mdEdit.git#master"
|
||||
"simplemde": "^1.11.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@ var sources = {
|
|||
config: ['karma.conf.js', 'gulpfile.js']
|
||||
};
|
||||
|
||||
var wrappers = '(function(angular, $, requestToken, mdEdit, undefined){'+
|
||||
var wrappers = '(function(angular, $, requestToken, SimpleMDE, undefined){'+
|
||||
'\'use strict\';<%= contents %>' +
|
||||
'})(angular, jQuery, oc_requesttoken, mdEdit);';
|
||||
'})(angular, jQuery, oc_requesttoken, SimpleMDE);';
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,8 +32,7 @@ module.exports = function(config) {
|
|||
// list of files / patterns to load in the browser
|
||||
files: [
|
||||
'vendor/jquery/dist/jquery.js',
|
||||
'vendor/prism/prism.js',
|
||||
'vendor/mdEdit/mdedit.js',
|
||||
'vendor/simplemde/dist/simplemde.min.js',
|
||||
'vendor/angular/angular.js',
|
||||
'vendor/underscore/underscore.js',
|
||||
'vendor/angular-route/angular-route.js',
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
!function(e,n,o,i,r){"use strict";var u=e.module("Notes",["restangular","ngRoute"]).config(["$provide","$routeProvider","RestangularProvider","$httpProvider","$windowProvider",function(t,e,n,i,r){i.defaults.headers.common.requesttoken=o,t.value("Constants",{saveInterval:5e3}),e.when("/notes/:noteId",{templateUrl:"note.html",controller:"NoteController",resolve:{note:["$route","$q","is","Restangular",function(t,e,n,o){var i=e.defer(),r=t.current.params.noteId;return n.loading=!0,o.one("notes",r).get().then(function(t){n.loading=!1,i.resolve(t)},function(){n.loading=!1,i.reject()}),i.promise}]}}).otherwise({redirectTo:"/"});var u=OC.generateUrl("/apps/notes");n.setBaseUrl(u)}]).run(["$rootScope","$location","NotesModel",function(t,e,o){n('link[rel="shortcut icon"]').attr("href",OC.filePath("notes","img","favicon.png")),t.$on("$routeChangeError",function(){var t=o.getAll();if(t.length>0){var n=t.sort(function(t,e){return t.modified>e.modified?1:t.modified<e.modified?-1:0}),i=t[n.length-1];e.path("/notes/"+i.id)}else e.path("/")})}]);u.controller("AppController",["$scope","$location","is",function(t,e,n){t.is=n,t.init=function(t){0!==t&&e.path("/notes/"+t)},t.search=""}]),u.controller("NoteController",["$routeParams","$scope","NotesModel","SaveQueue","note",function(e,n,o,i,r){o.updateIfExists(r),n.note=o.get(e.noteId),n.isSaving=function(){return i.isSaving()},n.updateTitle=function(){n.note.title=n.note.content.split("\n")[0]||t("notes","New note")},n.save=function(){var t=n.note;i.add(t)}}]),u.controller("NotesController",["$routeParams","$scope","$location","Restangular","NotesModel",function(t,e,n,o,i){e.route=t,e.notes=i.getAll();var r=o.all("notes");r.getList().then(function(t){i.addAll(t)}),e.create=function(){r.post().then(function(t){i.add(t),n.path("/notes/"+t.id)})},e["delete"]=function(t){var n=i.get(t);n.remove().then(function(){i.remove(t),e.$emit("$routeChangeError")})},e.toggleFavorite=function(t){var e=i.get(t);e.customPUT({favorite:!e.favorite},"favorite",{},{}).then(function(t){e.favorite=!!t})}}]),u.directive("notesAutofocus",function(){return{restrict:"A",link:function(t,e){e.focus()}}}),u.directive("editor",["$timeout",function(t){return{restrict:"A",link:function(e,o){var r=i(o[0],{change:function(n){t(function(){e.$apply(function(){e.note.content=n,e.updateTitle()})})}});r.setValue(e.note.content),o.on("click",".link",function(t){if(t.ctrlKey){var e=n(this).find(".link-params-inner").text();window.open(e,"_blank")}})}}}]),u.directive("notesIsSaving",["$window",function(e){return{restrict:"A",scope:{notesIsSaving:"="},link:function(n){e.onbeforeunload=function(){return n.notesIsSaving?t("notes","Note is currently saving. Leaving the page will delete all changes!"):null}}}}]),u.directive("notesTimeoutChange",["$timeout",function(t){return{restrict:"A",link:function(e,o,i){var r,u=300;n(o).bind("input propertychange paste",function(){t.cancel(r),r=t(function(){e.$apply(i.notesTimeoutChange)},u)})}}}]),u.directive("notesTooltip",function(){return{restrict:"A",link:function(t,e){e.tooltip()}}}),u.filter("and",["$filter",function(t){return function(e,n){var o=n.split(" "),i=e;for(var r in o)i=t("filter")(i,o[r]);return i}}]),u.filter("noteTitle",function(){return function(t){return t=t.split("\n")[0]||"newNote",t.trim().replace(/^#+/g,"")}}),u.filter("wordCount",function(){return function(t){if(t&&"string"==typeof t){var e=t.split(/\s+/).filter(function(t){return t.search(/[A-Za-z0-9]/)!==-1}).length;return window.n("notes","%n word","%n words",e)}return 0}}),u.factory("is",function(){return{loading:!1}}),u.factory("NotesModel",function(){var t=function(){this.notes=[],this.notesIds={}};return t.prototype={addAll:function(t){for(var e=0;e<t.length;e+=1)this.add(t[e])},add:function(t){this.updateIfExists(t)},getAll:function(){return this.notes},get:function(t){return this.notesIds[t]},updateIfExists:function(t){var n=this.notesIds[t.id];e.isDefined(n)?(n.title=t.title,n.modified=t.modified,n.content=t.content,n.favorite=t.favorite):(this.notes.push(t),this.notesIds[t.id]=t)},remove:function(t){for(var e=0;e<this.notes.length;e+=1){var n=this.notes[e];if(n.id===t){this.notes.splice(e,1),delete this.notesIds[t];break}}}},new t}),u.factory("SaveQueue",["$q",function(t){var e=function(){this._queue={},this._flushLock=!1};return e.prototype={add:function(t){this._queue[t.id]=t,this._flush()},_flush:function(){var e=Object.keys(this._queue);if(0!==e.length&&!this._flushLock){this._flushLock=!0;for(var n=this,o=[],i=0;i<e.length;i+=1){var r=this._queue[e[i]];o.push(r.put().then(this._noteUpdateRequest.bind(null,r)))}this._queue={},t.all(o).then(function(){n._flushLock=!1,n._flush()})}},_noteUpdateRequest:function(t,e){t.title=e.title,t.modified=e.modified},isSaving:function(){return this._flushLock}},new e}])}(angular,jQuery,oc_requesttoken,mdEdit);
|
||||
!function(e,n,o,i,r){"use strict";var u=e.module("Notes",["restangular","ngRoute"]).config(["$provide","$routeProvider","RestangularProvider","$httpProvider","$windowProvider",function(t,e,n,i,r){i.defaults.headers.common.requesttoken=o,t.value("Constants",{saveInterval:5e3}),e.when("/notes/:noteId",{templateUrl:"note.html",controller:"NoteController",resolve:{note:["$route","$q","is","Restangular",function(t,e,n,o){var i=e.defer(),r=t.current.params.noteId;return n.loading=!0,o.one("notes",r).get().then(function(t){n.loading=!1,i.resolve(t)},function(){n.loading=!1,i.reject()}),i.promise}]}}).otherwise({redirectTo:"/"});var u=OC.generateUrl("/apps/notes");n.setBaseUrl(u)}]).run(["$rootScope","$location","NotesModel",function(t,e,o){n('link[rel="shortcut icon"]').attr("href",OC.filePath("notes","img","favicon.png")),t.$on("$routeChangeError",function(){var t=o.getAll();if(t.length>0){var n=t.sort(function(t,e){return t.modified>e.modified?1:t.modified<e.modified?-1:0}),i=t[n.length-1];e.path("/notes/"+i.id)}else e.path("/")})}]);u.controller("AppController",["$scope","$location","is",function(t,e,n){t.is=n,t.init=function(t){0!==t&&e.path("/notes/"+t)},t.search=""}]),u.controller("NoteController",["$routeParams","$scope","NotesModel","SaveQueue","note","debounce",function(e,n,o,i,r,u){o.updateIfExists(r),n.note=o.get(e.noteId),n.isSaving=function(){return i.isSaving()},n.updateTitle=function(){n.note.title=n.note.content.split("\n")[0]||t("notes","New note")},n.save=u(function(){var t=n.note;i.add(t)},300)}]),u.controller("NotesController",["$routeParams","$scope","$location","Restangular","NotesModel",function(t,e,n,o,i){e.route=t,e.notes=i.getAll();var r=o.all("notes");r.getList().then(function(t){i.addAll(t)}),e.create=function(){r.post().then(function(t){i.add(t),n.path("/notes/"+t.id)})},e["delete"]=function(t){var n=i.get(t);n.remove().then(function(){i.remove(t),e.$emit("$routeChangeError")})},e.toggleFavorite=function(t){var e=i.get(t);e.customPUT({favorite:!e.favorite},"favorite",{},{}).then(function(t){e.favorite=!!t})}}]),u.filter("and",["$filter",function(t){return function(e,n){var o=n.split(" "),i=e;for(var r in o)i=t("filter")(i,o[r]);return i}}]),u.filter("noteTitle",function(){return function(t){return t=t.split("\n")[0]||"newNote",t.trim().replace(/^#+/g,"")}}),u.filter("wordCount",function(){return function(t){if(t&&"string"==typeof t){var e=t.split(/\s+/).filter(function(t){return t.search(/[A-Za-z0-9]/)!==-1}).length;return window.n("notes","%n word","%n words",e)}return 0}}),u.factory("debounce",["$timeout",function(t){return function(e,n){var o;return function(){var i=this,r=arguments;o&&t.cancel(o),o=t(function(){e.apply(i,r)},n)}}}]),u.factory("is",function(){return{loading:!1}}),u.factory("NotesModel",function(){var t=function(){this.notes=[],this.notesIds={}};return t.prototype={addAll:function(t){for(var e=0;e<t.length;e+=1)this.add(t[e])},add:function(t){this.updateIfExists(t)},getAll:function(){return this.notes},get:function(t){return this.notesIds[t]},updateIfExists:function(t){var n=this.notesIds[t.id];e.isDefined(n)?(n.title=t.title,n.modified=t.modified,n.content=t.content,n.favorite=t.favorite):(this.notes.push(t),this.notesIds[t.id]=t)},remove:function(t){for(var e=0;e<this.notes.length;e+=1){var n=this.notes[e];if(n.id===t){this.notes.splice(e,1),delete this.notesIds[t];break}}}},new t}),u.factory("SaveQueue",["$q",function(t){var e=function(){this._queue={},this._flushLock=!1};return e.prototype={add:function(t){this._queue[t.id]=t,this._flush()},_flush:function(){var e=Object.keys(this._queue);if(0!==e.length&&!this._flushLock){this._flushLock=!0;for(var n=this,o=[],i=0;i<e.length;i+=1){var r=this._queue[e[i]];o.push(r.put().then(this._noteUpdateRequest.bind(null,r)))}this._queue={},t.all(o).then(function(){n._flushLock=!1,n._flush()})}},_noteUpdateRequest:function(t,e){t.title=e.title,t.modified=e.modified},isSaving:function(){return this._flushLock}},new e}]),u.directive("notesAutofocus",function(){return{restrict:"A",link:function(t,e){e.focus()}}}),u.directive("editor",["$timeout",function(t){return{restrict:"A",link:function(e,o){var r=new i({element:o[0],spellChecker:!1,autoDownloadFontAwesome:!1,toolbar:!1,status:!1,forceSync:!0});n(r.codemirror.getWrapperElement());r.value(e.note.content),r.codemirror.on("change",function(){t(function(){e.$apply(function(){e.note.content=r.value(),e.save(),e.updateTitle()})})})}}}]),u.directive("notesIsSaving",["$window",function(e){return{restrict:"A",scope:{notesIsSaving:"="},link:function(n){e.onbeforeunload=function(){return n.notesIsSaving?t("notes","Note is currently saving. Leaving the page will delete all changes!"):null}}}}]),u.directive("notesTooltip",function(){return{restrict:"A",link:function(t,e){e.tooltip()}}})}(angular,jQuery,oc_requesttoken,SimpleMDE);
|
||||
//# sourceMappingURL=app.min.js.map
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,39 +0,0 @@
|
|||
{
|
||||
"name": "mdEdit",
|
||||
"homepage": "https://github.com/jbt/mdEdit",
|
||||
"authors": [
|
||||
"James Taylor <jt@gosquared.com>"
|
||||
],
|
||||
"description": "nice syntax-highlighted markdown editor view component",
|
||||
"main": [
|
||||
"mdedit.js",
|
||||
"mdedit.css"
|
||||
],
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"markdown",
|
||||
"editor",
|
||||
"highlight"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"_release": "4812667576",
|
||||
"_resolution": {
|
||||
"type": "branch",
|
||||
"branch": "master",
|
||||
"commit": "48126675762e07c7b29576451c24c0cb60ea6ef6"
|
||||
},
|
||||
"_source": "https://github.com/jbt/mdEdit.git",
|
||||
"_target": "master",
|
||||
"_originalSource": "https://github.com/jbt/mdEdit.git"
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 James Taylor
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -1,30 +0,0 @@
|
|||
# mdEdit
|
||||
|
||||
Syntax-highlighted / semi-formatted markdown editor view with minimal dependencies.
|
||||
|
||||
As seen in my [online markdown editor](//jbt.github.io/markdown-editor) (the left-hand side is this editor, or more accurately it will be once I've merged [this pull request](https://github.com/jbt/markdown-editor/pull/25)).
|
||||
|
||||
Requires [Prism](//prismjs.com) - Prism core is required plus any languages you want to be syntax-highlighted inside fenced code blocks. The bundled `prism-all.js` includes _all_ available languages.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
* Include `prism.css` and `mdedit.css`
|
||||
* Include `prism-all.js` and `mdedit.js`
|
||||
* Include a `<pre>` element where you want an editor
|
||||
* Then `var editor = mdEdit(thatPreElement, {options})`;
|
||||
|
||||
|
||||
## API
|
||||
|
||||
* The `options` parameter to the constructor may include the following configuration options:
|
||||
* `className` - any css classes to apply to the editor view
|
||||
* `change` - callback function that is called whenever the editor value changes (value is passed as an argument)
|
||||
|
||||
* `editor.getValue()` - returns the current value of the editor view
|
||||
* `editor.setValue(val)` - sets the current value to `val` and updates the view
|
||||
|
||||
|
||||
## Browser support
|
||||
|
||||
Anything that supports ES5 well enough. That means (hopefully) IE9+, and all recent versions of all the other browsers.
|
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
"name": "mdEdit",
|
||||
"version": "0.1.0",
|
||||
"homepage": "https://github.com/jbt/mdEdit",
|
||||
"authors": [
|
||||
"James Taylor <jt@gosquared.com>"
|
||||
],
|
||||
"description": "nice syntax-highlighted markdown editor view component",
|
||||
"main": ["mdedit.js", "mdedit.css"],
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"markdown",
|
||||
"editor",
|
||||
"highlight"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
]
|
||||
}
|
|
@ -1,409 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="prism-all.js"></script>
|
||||
<link rel="stylesheet" href="prism.css">
|
||||
<link rel="stylesheet" href="mdedit.css">
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.mdedit {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre>
|
||||
|
||||
|
||||
# Big heading
|
||||
|
||||
## Smaller heading
|
||||
|
||||
### Smaller
|
||||
|
||||
#### And
|
||||
|
||||
##### Smaller
|
||||
|
||||
Something **strong**. Something _emphatic_. Some `code`. Something ~~deleted~~.
|
||||
|
||||
* Here
|
||||
* is a
|
||||
* list
|
||||
|
||||
1. Numbered
|
||||
2. Lists
|
||||
3. Too
|
||||
|
||||
> Block quotes
|
||||
> as well
|
||||
|
||||
[Links](foo) too [with titles](<bar> "and all that jazz"). Also ![images](img).
|
||||
|
||||
<html is="also valid markdown of course">
|
||||
|
||||
```javascript
|
||||
$('code').with(/languages/, function(){
|
||||
// Also gets syntax highlighting
|
||||
});
|
||||
```
|
||||
|
||||
\<escaped html doesn't count though>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# H1
|
||||
|
||||
## H2
|
||||
|
||||
### H3
|
||||
|
||||
#### H4
|
||||
|
||||
##### H5
|
||||
|
||||
##### H6
|
||||
|
||||
## H2 with trailing hashes ##
|
||||
|
||||
|
||||
|
||||
### H3 with some leading space
|
||||
|
||||
|
||||
# H1 indented too far
|
||||
|
||||
|
||||
seText-style H1
|
||||
======
|
||||
|
||||
|
||||
|
||||
seText-style H2
|
||||
------
|
||||
|
||||
|
||||
unaligned H1
|
||||
=
|
||||
|
||||
|
||||
unaligned h2
|
||||
--
|
||||
|
||||
|
||||
h1 indented too far
|
||||
=
|
||||
|
||||
|
||||
|
||||
|
||||
not an hr:
|
||||
|
||||
===
|
||||
|
||||
|
||||
this is an hr:
|
||||
|
||||
***
|
||||
|
||||
and this:
|
||||
|
||||
---
|
||||
|
||||
and this:
|
||||
|
||||
___
|
||||
|
||||
|
||||
and this:
|
||||
|
||||
* * * * ** **
|
||||
|
||||
not this:
|
||||
|
||||
* _ *
|
||||
|
||||
|
||||
|
||||
|
||||
**strong** stuff
|
||||
|
||||
__strong
|
||||
stuff__
|
||||
|
||||
|
||||
**not strong
|
||||
|
||||
stuff**
|
||||
|
||||
|
||||
|
||||
|
||||
Here is some _emphatic_ stuff
|
||||
|
||||
|
||||
*emphatic
|
||||
stuff I say!*
|
||||
|
||||
|
||||
_not
|
||||
|
||||
very emphatic_
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Here is a **strong, *emphatic* thing**.
|
||||
|
||||
And **another *one***
|
||||
|
||||
And ***another one!***
|
||||
|
||||
And **_this_ one too**
|
||||
|
||||
And __this *one*__
|
||||
|
||||
This __is **silly though**__
|
||||
|
||||
|
||||
Here is an _emphatic, **strong** thing_
|
||||
|
||||
And _another __one___
|
||||
|
||||
And *another **one***
|
||||
|
||||
|
||||
~~deleted stuff~~
|
||||
|
||||
|
||||
* list
|
||||
* listy
|
||||
* listy
|
||||
|
||||
1. num
|
||||
* bered
|
||||
* lists
|
||||
moar
|
||||
* blah
|
||||
|
||||
|
||||
* **formatting** _in_ ~~lists~~ please with `code` and stuff
|
||||
* nesting?
|
||||
* maybe
|
||||
* too?
|
||||
|
||||
|
||||
|
||||
`code`
|
||||
|
||||
Lots of text with `code` in it
|
||||
|
||||
Code `has no *stuff inside it*`.
|
||||
|
||||
# Even `headings` can have code _and other_ **things**
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[link](aaaa)
|
||||
|
||||
[link](<aaa>)
|
||||
|
||||
[link](aaaa "title")
|
||||
|
||||
[link](aaaa(foo) "tit\"le")
|
||||
|
||||
[link](<blahblah> 'som"e"thing')
|
||||
|
||||
|
||||
![IMAGE](image)
|
||||
|
||||
![IMAGE](<aaa>)
|
||||
|
||||
![IMAGE](aaaa "title")
|
||||
|
||||
![IMAGE](aaaa(foo) "tit\"le")
|
||||
|
||||
![IMAGE](<blahblah> 'som"e"thing')
|
||||
|
||||
|
||||
|
||||
[link **with** _somme_ `formatting`](foo)
|
||||
|
||||
![image **with** _some_ `formatting`](bar)
|
||||
|
||||
|
||||
This probably won't work:
|
||||
|
||||
[link with ![an image](foo)](bar)
|
||||
|
||||
|
||||
|
||||
> blockquote
|
||||
|
||||
|
||||
|
||||
> blockquote
|
||||
> long
|
||||
> long
|
||||
> blockquote
|
||||
|
||||
> blockquote
|
||||
with
|
||||
lazy
|
||||
coninutation
|
||||
> and picking
|
||||
> back up
|
||||
agan
|
||||
|
||||
> * list
|
||||
* inside
|
||||
* blockquote
|
||||
* omg
|
||||
|
||||
|
||||
|
||||
[refdef]: /blah "title"
|
||||
|
||||
[def2]:
|
||||
/blah
|
||||
"title"
|
||||
|
||||
|
||||
|
||||
[link][withRef]
|
||||
|
||||
[link] [with other ref]
|
||||
|
||||
![img][withref]
|
||||
|
||||
![img] [withotherref]
|
||||
|
||||
|
||||
[shortcut]
|
||||
|
||||
|
||||
[shortcut **can have stuff in it**]
|
||||
|
||||
[shortcut **can have stuff in it**]: /ref "can't though"
|
||||
|
||||
|
||||
![img shortcut]
|
||||
|
||||
|
||||
```
|
||||
CODE BLOK
|
||||
```
|
||||
|
||||
|
||||
~~~
|
||||
CODE BLOK
|
||||
~~~
|
||||
|
||||
indented
|
||||
code is da
|
||||
best
|
||||
|
||||
|
||||
```html
|
||||
<hi iam="some html">
|
||||
```
|
||||
|
||||
~~~html
|
||||
<hi iam="some html">
|
||||
~~~
|
||||
|
||||
|
||||
|
||||
Righty
|
||||
|
||||
<table>
|
||||
hi I am some html
|
||||
</table>
|
||||
|
||||
|
||||
## <i class="foo bar">ok then</i> stuffs
|
||||
|
||||
|
||||
|
||||
---
|
||||
Still to do:
|
||||
|
||||
* footnotes
|
||||
* emoji
|
||||
* tables
|
||||
* emails + urls
|
||||
|
||||
Bigger stuff:
|
||||
|
||||
* Tweak Prism for a better concept of ordering and precedence
|
||||
* Lots of actions
|
||||
* ctrl-b bold/unbold
|
||||
* ctrl-i em/un-em
|
||||
* Sections?
|
||||
* urldef linkText / linkLabel?
|
||||
* think through linktext not allowing other links etc
|
||||
|
||||
</pre>
|
||||
|
||||
<script src="mdedit.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
var e = mdEdit(document.querySelector('pre'), {
|
||||
// change: function(value){ console.log('VALUE CHANGED', value); }
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,34 +0,0 @@
|
|||
var gulp = require('gulp');
|
||||
var concat = require('gulp-concat');
|
||||
var rename = require('gulp-rename');
|
||||
var uglify = require('gulp-uglify');
|
||||
var wrap = require('gulp-wrap-umd');
|
||||
var del = require('del');
|
||||
|
||||
gulp.task('build', function(){
|
||||
return gulp.src([
|
||||
'src/yaml.js',
|
||||
'src/md.js',
|
||||
'src/util.js',
|
||||
'src/actions.js',
|
||||
'src/SelectionManager.js',
|
||||
'src/UndoManager.js',
|
||||
'src/Editor.js'
|
||||
])
|
||||
.pipe(concat('mdedit.js'))
|
||||
.pipe(wrap({
|
||||
namespace: 'mdEdit',
|
||||
deps: [
|
||||
{ name: 'prismjs', paramName: 'Prism', globalName: 'Prism', amdName: 'prismjs' }
|
||||
],
|
||||
exports: 'Editor'
|
||||
}))
|
||||
.pipe(gulp.dest('./'))
|
||||
.pipe(rename({ suffix: '.min' }))
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest('./'));
|
||||
});
|
||||
|
||||
gulp.task('clean', function(cb) {
|
||||
del(['mdedit.js', 'mdedit.min.js'], cb);
|
||||
});
|
|
@ -1,57 +0,0 @@
|
|||
|
||||
.mdedit {
|
||||
font-size: 12px;
|
||||
line-height: 1.3;
|
||||
color: black;
|
||||
/*text-shadow: 0 1px white;*/
|
||||
font-family: Consolas, Monaco, 'Andale Mono', monospace;
|
||||
direction: ltr;
|
||||
text-align: left;
|
||||
white-space: pre;
|
||||
/*************/ white-space: pre-wrap;
|
||||
word-spacing: normal;
|
||||
word-break: normal;
|
||||
line-height: 1.5;
|
||||
|
||||
-moz-tab-size: 4;
|
||||
-o-tab-size: 4;
|
||||
tab-size: 4;
|
||||
|
||||
-webkit-hyphens: none;
|
||||
-moz-hyphens: none;
|
||||
-ms-hyphens: none;
|
||||
hyphens: none;
|
||||
padding: 1em;
|
||||
overflow: auto;
|
||||
background: #f5f2f0;
|
||||
}
|
||||
|
||||
.mdedit:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.mdedit::-moz-selection, .mdedit ::-moz-selection {
|
||||
background: #b3d4fc;
|
||||
}
|
||||
|
||||
.mdedit::selection, .mdedit ::selection {
|
||||
background: #b3d4fc;
|
||||
}
|
||||
|
||||
.mdedit .heading { font-weight: bold; }
|
||||
.mdedit .heading .heading-hash { font-weight: normal; }
|
||||
.mdedit .heading .heading-setext-line { font-weight: normal; }
|
||||
.mdedit .heading.heading-1 { font-size: 2em; }
|
||||
.mdedit .heading.heading-2 { font-size: 1.75em; }
|
||||
.mdedit .heading.heading-3 { font-size: 1.5em; }
|
||||
.mdedit .heading.heading-4 { font-size: 1.3em; }
|
||||
.mdedit .heading.heading-5 { font-size: 1.2em; }
|
||||
.mdedit .heading.heading-6 { font-size: 1.15em; }
|
||||
.mdedit .marker { color: rgba(120,120,120,0.5); }
|
||||
.mdedit .strong { font-weight: bold; }
|
||||
.mdedit .em { font-style: italic; }
|
||||
.mdedit .strike-inner { text-decoration: line-through }
|
||||
.mdedit .code { background: rgba(120,120,120,0.1); padding: 0.15em 0; }
|
||||
.mdedit .href, .mdedit .braced-href .braced-href-inner { color: rgba(120,120,120,0.8); text-decoration: underline; }
|
||||
.mdedit .blockquote-content, .mdedit .code-block.untagged .code-inner, .mdedit .code-block .code-language, .mdedit .code-block.indented { color: #555; }
|
||||
.mdedit .link-text-inner { text-decoration: underline; }
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -1,32 +0,0 @@
|
|||
{
|
||||
"name": "mdEdit",
|
||||
"version": "0.1.0",
|
||||
"description": "nice syntax-highlighted markdown editor view component",
|
||||
"main": "mdedit.js",
|
||||
"devDependencies": {
|
||||
"del": "^2.0.2",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-uglify": "^1.4.1",
|
||||
"gulp-wrap-umd": "^0.2.1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jbt/mdEdit"
|
||||
},
|
||||
"keywords": [
|
||||
"markdown",
|
||||
"editor",
|
||||
"highlight"
|
||||
],
|
||||
"author": "James Taylor <jt@gosquared.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jbt/mdEdit/issues"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "gulp build",
|
||||
"clean": "gulp clean"
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -1,137 +0,0 @@
|
|||
/* http://prismjs.com/download.html?themes=prism&languages=markup+markdown */
|
||||
/**
|
||||
* prism.js default theme for JavaScript, CSS and HTML
|
||||
* Based on dabblet (http://dabblet.com)
|
||||
* @author Lea Verou
|
||||
*/
|
||||
|
||||
code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
color: black;
|
||||
text-shadow: 0 1px white;
|
||||
font-family: Consolas, Monaco, 'Andale Mono', monospace;
|
||||
direction: ltr;
|
||||
text-align: left;
|
||||
white-space: pre;
|
||||
white-space: pre-wrap;
|
||||
word-spacing: normal;
|
||||
word-break: normal;
|
||||
line-height: 1.5;
|
||||
|
||||
-moz-tab-size: 4;
|
||||
-o-tab-size: 4;
|
||||
tab-size: 4;
|
||||
|
||||
-webkit-hyphens: none;
|
||||
-moz-hyphens: none;
|
||||
-ms-hyphens: none;
|
||||
hyphens: none;
|
||||
}
|
||||
|
||||
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
|
||||
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
|
||||
text-shadow: none;
|
||||
background: #b3d4fc;
|
||||
}
|
||||
|
||||
pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
|
||||
code[class*="language-"]::selection, code[class*="language-"] ::selection {
|
||||
text-shadow: none;
|
||||
background: #b3d4fc;
|
||||
}
|
||||
|
||||
@media print {
|
||||
code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
text-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Code blocks */
|
||||
pre[class*="language-"] {
|
||||
padding: 1em;
|
||||
margin: .5em 0;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
:not(pre) > code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
background: #f5f2f0;
|
||||
}
|
||||
|
||||
/* Inline code */
|
||||
:not(pre) > code[class*="language-"] {
|
||||
padding: .1em;
|
||||
border-radius: .3em;
|
||||
}
|
||||
|
||||
.token.comment,
|
||||
.token.prolog,
|
||||
.token.doctype,
|
||||
.token.cdata {
|
||||
color: slategray;
|
||||
}
|
||||
|
||||
.token.punctuation {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.namespace {
|
||||
opacity: .7;
|
||||
}
|
||||
|
||||
.token.property,
|
||||
.token.tag,
|
||||
.token.boolean,
|
||||
.token.number,
|
||||
.token.constant,
|
||||
.token.symbol,
|
||||
.token.deleted {
|
||||
color: #905;
|
||||
}
|
||||
|
||||
.token.selector,
|
||||
.token.attr-name,
|
||||
.token.string,
|
||||
.token.char,
|
||||
.token.builtin,
|
||||
.token.inserted {
|
||||
color: #690;
|
||||
}
|
||||
|
||||
.token.operator,
|
||||
.token.entity,
|
||||
.token.url,
|
||||
.language-css .token.string,
|
||||
.style .token.string {
|
||||
color: #a67f59;
|
||||
background: hsla(0, 0%, 100%, .5);
|
||||
}
|
||||
|
||||
.token.atrule,
|
||||
.token.attr-value,
|
||||
.token.keyword {
|
||||
color: #07a;
|
||||
}
|
||||
|
||||
.token.function {
|
||||
color: #DD4A68;
|
||||
}
|
||||
|
||||
.token.regex,
|
||||
.token.important,
|
||||
.token.variable {
|
||||
color: #e90;
|
||||
}
|
||||
|
||||
.token.important,
|
||||
.token.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
.token.italic {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.token.entity {
|
||||
cursor: help;
|
||||
}
|
|
@ -1,313 +0,0 @@
|
|||
function Editor(el, opts){
|
||||
|
||||
if(!(this instanceof Editor)){
|
||||
return new Editor(el, opts);
|
||||
}
|
||||
|
||||
opts = opts || {};
|
||||
|
||||
if(el.tagName === 'PRE'){
|
||||
this.el = el;
|
||||
}else{
|
||||
this.el = document.createElement('pre');
|
||||
el.appendChild(this.el);
|
||||
}
|
||||
|
||||
var cname = opts['className'] || '';
|
||||
|
||||
this.el.className = this.el.className ? this.el.className + ' ' : '';
|
||||
this.el.className += 'mdedit' + (cname ? ' ' + cname : '');
|
||||
this.el.setAttribute('contenteditable', true);
|
||||
|
||||
var inner = this.inner = document.createElement('div');
|
||||
inner.innerHTML = this.el.innerHTML;
|
||||
this.el.innerHTML = '';
|
||||
this.el.appendChild(inner);
|
||||
|
||||
this.selMgr = new SelectionManager(el);
|
||||
this.undoMgr = new UndoManager(this);
|
||||
|
||||
evt.bind(el, 'cut', this.cut.bind(this));
|
||||
evt.bind(el, 'paste', this.paste.bind(this));
|
||||
evt.bind(el, 'keyup', this.keyup.bind(this));
|
||||
evt.bind(el, 'input', this.changed.bind(this));
|
||||
evt.bind(el, 'keydown', this.keydown.bind(this));
|
||||
evt.bind(el, 'keypress', this.keypress.bind(this));
|
||||
|
||||
|
||||
var changeCb = opts['change'];
|
||||
this.changeCb = changeCb || function(){};
|
||||
|
||||
this.changed();
|
||||
}
|
||||
|
||||
Editor.prototype.fireChange = function(){
|
||||
var prev = this._prevValue;
|
||||
var now = this.getValue();
|
||||
if(prev !== now){
|
||||
this.changeCb(now);
|
||||
this._prevValue = now;
|
||||
}
|
||||
};
|
||||
|
||||
Editor.prototype['setValue'] = function(val){
|
||||
this.setText(val);
|
||||
this.changed();
|
||||
};
|
||||
|
||||
Editor.prototype['getValue'] = function(){
|
||||
return this.getText();
|
||||
};
|
||||
|
||||
Editor.prototype.getText = function(){
|
||||
return this.inner.textContent;
|
||||
};
|
||||
|
||||
Editor.prototype.setText = function(val){
|
||||
this.inner.textContent = val;
|
||||
};
|
||||
|
||||
Editor.prototype.keyup = function(evt){
|
||||
var keyCode = evt && evt.keyCode || 0,
|
||||
code = this.getText();
|
||||
|
||||
if([
|
||||
9, 91, 93, 16, 17, 18, // modifiers
|
||||
20, // caps lock
|
||||
13, // Enter (handled by keydown)
|
||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, // F[0-12]
|
||||
27 // Esc
|
||||
].indexOf(keyCode) > -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if([
|
||||
33, 34, // PgUp, PgDn
|
||||
35, 36, // End, Home
|
||||
37, 39, 38, 40 // Left, Right, Up, Down
|
||||
].indexOf(keyCode) === -1) {
|
||||
this.changed();
|
||||
}
|
||||
};
|
||||
|
||||
Editor.prototype.changed = function(evt){
|
||||
var code = this.getText();
|
||||
|
||||
var ss = this.selMgr.getStart(),
|
||||
se = this.selMgr.getEnd();
|
||||
|
||||
this.saveScrollPos();
|
||||
|
||||
var setHTML;
|
||||
|
||||
if(code === this._prevCode){
|
||||
if(this.inner.innerHTML !== this._prevHTML) setHTML = this._prevHTML;
|
||||
}else{
|
||||
this._prevHTML = setHTML = Prism['highlight'](code, md);
|
||||
}
|
||||
this._prevCode = code;
|
||||
|
||||
if(setHTML !== undefined){
|
||||
if(!/\n$/.test(code)) {
|
||||
setHTML += '\n';
|
||||
}
|
||||
|
||||
var dummy = this.inner.cloneNode(false);
|
||||
dummy.innerHTML = setHTML;
|
||||
this.el.replaceChild(dummy, this.inner);
|
||||
this.inner = dummy;
|
||||
}
|
||||
|
||||
this.restoreScrollPos();
|
||||
|
||||
if(ss !== null || se !== null) {
|
||||
this.selMgr.setRange(ss, se);
|
||||
}
|
||||
|
||||
this.fireChange();
|
||||
};
|
||||
|
||||
Editor.prototype.saveScrollPos = function(){
|
||||
if(this.st === undefined) this.st = this.el.scrollTop;
|
||||
setTimeout(function(){
|
||||
this.st = undefined;
|
||||
}.bind(this), 500);
|
||||
};
|
||||
|
||||
Editor.prototype.restoreScrollPos = function(){
|
||||
this.el.scrollTop = this.st;
|
||||
this.st = undefined;
|
||||
};
|
||||
|
||||
|
||||
Editor.prototype.keypress = function(evt){
|
||||
var ctrl = evt.metaKey || evt.ctrlKey;
|
||||
|
||||
if(ctrl) return;
|
||||
|
||||
var code = evt.charCode;
|
||||
|
||||
if(!code) return;
|
||||
|
||||
var start = this.selMgr.getStart();
|
||||
var end = this.selMgr.getEnd();
|
||||
|
||||
var chr = String.fromCharCode(code);
|
||||
|
||||
if(/[\[\{\(<"'~\*_]/.test(chr) && start !== end){
|
||||
this.action('wrap', {
|
||||
bracket: chr
|
||||
});
|
||||
evt.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
this.undoMgr.action({
|
||||
add: chr,
|
||||
del: start === end ? '' : this.getText().slice(start, end),
|
||||
start: start
|
||||
});
|
||||
};
|
||||
|
||||
Editor.prototype.keydown = function(evt){
|
||||
var cmdOrCtrl = evt.metaKey || evt.ctrlKey;
|
||||
|
||||
switch(evt.keyCode) {
|
||||
case 8: // Backspace
|
||||
case 46: // Delete
|
||||
var start = this.selMgr.getStart();
|
||||
var end = this.selMgr.getEnd();
|
||||
var length = start === end ? 1 : Math.abs(end - start);
|
||||
start = evt.keyCode === 8 ? end - length : start;
|
||||
this.undoMgr.action({
|
||||
add: '',
|
||||
del: this.getText().slice(start, start + length),
|
||||
start: start
|
||||
});
|
||||
break;
|
||||
case 9: // Tab
|
||||
if(!cmdOrCtrl) {
|
||||
this.action('indent', {
|
||||
inverse: evt.shiftKey
|
||||
});
|
||||
evt.preventDefault();
|
||||
}
|
||||
break;
|
||||
case 219: // [
|
||||
case 221: // ]
|
||||
if(cmdOrCtrl && !evt.shiftKey) {
|
||||
this.action('indent', {
|
||||
inverse: evt.keyCode === 219,
|
||||
ctrl: true
|
||||
});
|
||||
evt.preventDefault();
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
this.action('newline');
|
||||
evt.preventDefault();
|
||||
break;
|
||||
case 89:
|
||||
if(cmdOrCtrl){
|
||||
this.undoMgr.redo();
|
||||
evt.preventDefault();
|
||||
}
|
||||
break;
|
||||
case 90:
|
||||
if(cmdOrCtrl) {
|
||||
evt.shiftKey ? this.undoMgr.redo() : this.undoMgr.undo();
|
||||
evt.preventDefault();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
Editor.prototype.apply = function(action){
|
||||
this.setText(spliceString(this.getText(), action.start, action.del.length, action.add));
|
||||
this.selMgr.setRange(action.start, action.start + action.add.length);
|
||||
this.changed();
|
||||
};
|
||||
|
||||
Editor.prototype.action = function(act, opts){
|
||||
opts = opts || {};
|
||||
var text = this.getText();
|
||||
var start = opts.start || this.selMgr.getStart();
|
||||
var end = opts.end || this.selMgr.getEnd();
|
||||
|
||||
var state = {
|
||||
start: start,
|
||||
end: end,
|
||||
before: text.slice(0, start),
|
||||
after: text.slice(end),
|
||||
sel: text.slice(start, end)
|
||||
};
|
||||
|
||||
var a = actions[act](state, opts);
|
||||
|
||||
this.saveScrollPos();
|
||||
|
||||
this.setText(state.before + state.sel + state.after);
|
||||
|
||||
if(a && !opts.noHistory){
|
||||
this.undoMgr.action(a);
|
||||
}
|
||||
this.selMgr.setRange(state.start, state.end, false);
|
||||
|
||||
this.changed();
|
||||
|
||||
};
|
||||
|
||||
Editor.prototype.cut = function(){
|
||||
var start = this.selMgr.getStart();
|
||||
var end = this.selMgr.getEnd();
|
||||
if(start === end) return;
|
||||
|
||||
this.undoMgr.action({
|
||||
add: '',
|
||||
del: this.getText().slice(start, end),
|
||||
start: start
|
||||
});
|
||||
};
|
||||
|
||||
Editor.prototype.paste = function(evt){
|
||||
var start = this.selMgr.getStart();
|
||||
var end = this.selMgr.getEnd();
|
||||
var selection = start === end ? '' : this.getText().slice(start, end);
|
||||
|
||||
var self = this;
|
||||
|
||||
function applyPasted(pasted){
|
||||
self.undoMgr.action({
|
||||
add: pasted,
|
||||
del: selection,
|
||||
start: start
|
||||
});
|
||||
|
||||
start += pasted.length;
|
||||
self.selMgr.setRange(start, start);
|
||||
self.changed();
|
||||
}
|
||||
|
||||
if(evt.clipboardData){
|
||||
evt.preventDefault();
|
||||
|
||||
var pasted = evt.clipboardData.getData('text/plain');
|
||||
|
||||
this.apply({
|
||||
add: pasted,
|
||||
del: selection,
|
||||
start: start
|
||||
});
|
||||
|
||||
applyPasted(pasted);
|
||||
}else{
|
||||
// handle IE9 with no clipboardData. Flickers a bit if styles have changed :(
|
||||
setTimeout(function(){
|
||||
var newEnd = self.selMgr.getEnd();
|
||||
|
||||
applyPasted(self.getText().slice(start, newEnd));
|
||||
}, 0);
|
||||
}
|
||||
};
|
|
@ -1,158 +0,0 @@
|
|||
function SelectionManager(elt){
|
||||
this.elt = elt;
|
||||
}
|
||||
|
||||
SelectionManager.prototype.getStart = function(){
|
||||
var selection = getSelection();
|
||||
|
||||
if(!selection.rangeCount) return 0;
|
||||
|
||||
var range = selection.getRangeAt(0);
|
||||
var el = range.startContainer;
|
||||
var container = el;
|
||||
var offset = range.startOffset;
|
||||
|
||||
if(!(this.elt.compareDocumentPosition(el) & 0x10)){
|
||||
// selection is outside this element.
|
||||
return 0;
|
||||
}
|
||||
|
||||
do{
|
||||
while((el = el.previousSibling)){
|
||||
if(el.textContent){
|
||||
offset += el.textContent.length;
|
||||
}
|
||||
}
|
||||
|
||||
el = container = container.parentNode;
|
||||
}while(el && el !== this.elt);
|
||||
|
||||
return offset;
|
||||
};
|
||||
|
||||
SelectionManager.prototype.getEnd = function(){
|
||||
var selection = getSelection();
|
||||
|
||||
if(!selection.rangeCount) return 0;
|
||||
|
||||
return this.getStart() + String(selection.getRangeAt(0)).length;
|
||||
};
|
||||
|
||||
SelectionManager.prototype.setRange = function(start, end, noscroll){
|
||||
var range = document.createRange();
|
||||
var startOffset = findOffset(this.elt, start);
|
||||
var endOffset = startOffset;
|
||||
if(end && end !== start){
|
||||
endOffset = findOffset(this.elt, end);
|
||||
}else{
|
||||
if(noscroll !== false) scrollToCaret.call(this, endOffset.element, endOffset.offset);
|
||||
}
|
||||
|
||||
range.setStart(startOffset.element, startOffset.offset);
|
||||
range.setEnd(endOffset.element, endOffset.offset);
|
||||
|
||||
var selection = getSelection();
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
};
|
||||
|
||||
|
||||
|
||||
var caret = document.createElement('span');
|
||||
caret.style.position = 'absolute';
|
||||
caret.innerHTML = '|';
|
||||
|
||||
function scrollToCaret(el, offset){
|
||||
var t = el.textContent;
|
||||
var p = el.parentNode;
|
||||
var before = t.slice(0, offset);
|
||||
var after = t.slice(offset);
|
||||
|
||||
el.textContent = after;
|
||||
var b4 = document.createTextNode(before);
|
||||
p.insertBefore(caret, el);
|
||||
p.insertBefore(b4, caret);
|
||||
|
||||
// caret.scrollIntoViewIfNeeded();
|
||||
var tp = caret.offsetTop;
|
||||
var h = caret.offsetHeight;
|
||||
var ch = this.elt.offsetHeight;
|
||||
var st = this.elt.scrollTop;
|
||||
|
||||
el.textContent = t;
|
||||
p.removeChild(caret);
|
||||
p.removeChild(b4);
|
||||
|
||||
if(tp - st < 0){
|
||||
this.elt.scrollTop = tp;
|
||||
}else if(tp - st + h > ch){
|
||||
this.elt.scrollTop = tp + h - ch;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function findOffset(root, ss) {
|
||||
if(!root) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var offset = 0,
|
||||
element = root;
|
||||
|
||||
do {
|
||||
var container = element;
|
||||
element = element.firstChild;
|
||||
|
||||
if(element) {
|
||||
do {
|
||||
var len = element.textContent.length;
|
||||
|
||||
if(offset <= ss && offset + len > ss) {
|
||||
break;
|
||||
}
|
||||
|
||||
offset += len;
|
||||
} while(element = element.nextSibling);
|
||||
}
|
||||
|
||||
if(!element) {
|
||||
// It's the container's lastChild
|
||||
break;
|
||||
}
|
||||
} while(element && element.hasChildNodes() && element.nodeType != 3);
|
||||
|
||||
if(element) {
|
||||
return {
|
||||
element: element,
|
||||
offset: ss - offset
|
||||
};
|
||||
}
|
||||
else if(container) {
|
||||
element = container;
|
||||
|
||||
while(element && element.lastChild) {
|
||||
element = element.lastChild;
|
||||
}
|
||||
|
||||
if(element.nodeType === 3) {
|
||||
return {
|
||||
element: element,
|
||||
offset: element.textContent.length
|
||||
};
|
||||
}
|
||||
else {
|
||||
return {
|
||||
element: element,
|
||||
offset: 0
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
element: root,
|
||||
offset: 0,
|
||||
error: true
|
||||
};
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
function UndoManager(editor){
|
||||
this.editor = editor;
|
||||
|
||||
this.undoStack = [];
|
||||
this.redoStack = [];
|
||||
}
|
||||
|
||||
UndoManager.prototype.action = function(a){
|
||||
/// sanity?
|
||||
|
||||
if(this.undoStack.length && this.canCombine(this.undoStack[this.undoStack.length-1], a)){
|
||||
this.undoStack.push(this.combine(this.undoStack.pop(), a));
|
||||
}else{
|
||||
this.undoStack.push(a);
|
||||
}
|
||||
this.redoStack = [];
|
||||
};
|
||||
|
||||
UndoManager.prototype.canCombine = function(a, b){
|
||||
return (
|
||||
!a.action && !b.action &&
|
||||
!Array.isArray(a) && !Array.isArray(b) &&
|
||||
!(a.del && b.add) && !(a.add && b.del) &&
|
||||
!(a.add && !b.add) && !(!a.add && b.add) &&
|
||||
!(a.add && a.del) &&
|
||||
!(b.add && b.del) &&
|
||||
a.start + a.add.length === b.start + b.del.length
|
||||
);
|
||||
};
|
||||
|
||||
UndoManager.prototype.combine = function(a, b){
|
||||
return {
|
||||
add: a.add + b.add,
|
||||
del: b.del + a.del,
|
||||
start: Math.min(a.start, b.start)
|
||||
};
|
||||
};
|
||||
|
||||
UndoManager.prototype.undo = function(){
|
||||
if(!this.undoStack.length) return;
|
||||
|
||||
var a = this.undoStack.pop();
|
||||
this.redoStack.push(a);
|
||||
|
||||
this.applyInverse(a);
|
||||
};
|
||||
|
||||
UndoManager.prototype.redo = function(){
|
||||
if(!this.redoStack.length) return;
|
||||
|
||||
var a = this.redoStack.pop();
|
||||
this.undoStack.push(a);
|
||||
|
||||
this.apply(a);
|
||||
};
|
||||
|
||||
UndoManager.prototype.apply = function apply(a){
|
||||
if(Array.isArray(a)){
|
||||
a.forEach(apply.bind(this));
|
||||
return;
|
||||
}
|
||||
|
||||
if(a.action){
|
||||
this.editor.action(a.action, {
|
||||
inverse: a.inverse,
|
||||
start: a.start,
|
||||
end: a.end,
|
||||
noHistory: true
|
||||
});
|
||||
}else{
|
||||
this.editor.apply(a);
|
||||
}
|
||||
};
|
||||
|
||||
UndoManager.prototype.applyInverse = function inv(a){
|
||||
if(Array.isArray(a)){
|
||||
a.forEach(inv.bind(this));
|
||||
return;
|
||||
}
|
||||
|
||||
if(a.action){
|
||||
this.editor.action(a.action, {
|
||||
inverse: !a.inverse,
|
||||
start: a.start,
|
||||
end: a.end,
|
||||
noHistory: true
|
||||
});
|
||||
}else{
|
||||
this.editor.apply({
|
||||
start: a.start,
|
||||
end: a.end,
|
||||
del: a.add,
|
||||
add: a.del
|
||||
});
|
||||
}
|
||||
};
|
|
@ -1,98 +0,0 @@
|
|||
var actions = {
|
||||
'newline': function(state, options){
|
||||
var s = state.start;
|
||||
var lf = state.before.lastIndexOf('\n') + 1;
|
||||
var afterLf = state.before.slice(lf);
|
||||
var indent = afterLf.match(/^\s*/)[0];
|
||||
var add = indent;
|
||||
var clearPrevLine = false;
|
||||
|
||||
if(/^ {0,3}$/.test(indent)){ // maybe list
|
||||
var l = afterLf.slice(indent.length);
|
||||
if(/^[*+\-]\s+/.test(l)){
|
||||
add += l.match(/^[*+\-]\s+/)[0];
|
||||
clearPrevLine = /^[*+\-]\s+$/.test(l);
|
||||
}else if(/^\d+\.\s+/.test(l)){
|
||||
add += l.match(/^\d+\.\s+/)[0]
|
||||
.replace(/^\d+/, function(n){ return +n+1; });
|
||||
clearPrevLine = /^\d+\.\s+$/.test(l);
|
||||
}else if(/^>/.test(l)){
|
||||
add += l.match(/^>\s*/)[0];
|
||||
clearPrevLine = /^>\s*$/.test(l);
|
||||
}
|
||||
}
|
||||
|
||||
add = '\n' + add;
|
||||
|
||||
var del = state.sel;
|
||||
state.sel = '';
|
||||
|
||||
if(clearPrevLine){ // if prev line was actually an empty liste item, clear it
|
||||
del = afterLf + del;
|
||||
state.before = state.before.slice(0, lf);
|
||||
state.start -= afterLf.length;
|
||||
s -= afterLf.length;
|
||||
add = '\n';
|
||||
}
|
||||
|
||||
state.before += add;
|
||||
state.start += add.length;
|
||||
state.end = state.start;
|
||||
|
||||
return { add: add, del: del, start: s };
|
||||
},
|
||||
|
||||
'indent': function(state, options){
|
||||
var lf = state.before.lastIndexOf('\n') + 1;
|
||||
|
||||
// TODO deal with soft tabs
|
||||
|
||||
if(options.inverse){
|
||||
if(/\s/.test(state.before.charAt(lf))){
|
||||
state.before = spliceString(state.before, lf, 1);
|
||||
state.start -= 1;
|
||||
}
|
||||
state.sel = state.sel.replace(/\r?\n(?!\r?\n)\s/, '\n');
|
||||
}else if(state.sel || options.ctrl){
|
||||
state.before = spliceString(state.before, lf, 0, '\t');
|
||||
state.sel = state.sel.replace(/\r?\n/, '\n\t');
|
||||
state.start += 1;
|
||||
}else{
|
||||
state.before += '\t';
|
||||
state.start += 1;
|
||||
state.end += 1;
|
||||
|
||||
return { add: '\t', del: '', start: state.start - 1 };
|
||||
}
|
||||
|
||||
state.end = state.start + state.sel.length;
|
||||
|
||||
return {
|
||||
action: 'indent',
|
||||
start: state.start,
|
||||
end: state.end,
|
||||
inverse: options.inverse
|
||||
};
|
||||
},
|
||||
|
||||
'wrap': function(state, options){
|
||||
var match = {
|
||||
'(': ')',
|
||||
'[': ']',
|
||||
'{': '}',
|
||||
'<': '>'
|
||||
}[options.bracket] || options.bracket;
|
||||
|
||||
state.before += options.bracket;
|
||||
state.after = match + state.after;
|
||||
state.start += 1;
|
||||
state.end += 1;
|
||||
|
||||
return {
|
||||
add: options.bracket + state.sel + match,
|
||||
del: state.sel,
|
||||
start: state.start - 1,
|
||||
end: state.end - 1
|
||||
};
|
||||
}
|
||||
};
|
|
@ -1,365 +0,0 @@
|
|||
var md = (function(){
|
||||
var md = {
|
||||
'comment': Prism['languages']['markup']['comment']
|
||||
};
|
||||
|
||||
|
||||
md['front-matter'] = {
|
||||
'pattern': /^---\n[\s\S]*?\n---(?=\n|$)/,
|
||||
'inside': {
|
||||
'marker front-matter-marker start': /^---/,
|
||||
'marker front-matter-marker end': /---$/,
|
||||
'rest': yaml
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var inlines = {};
|
||||
var blocks = {};
|
||||
|
||||
function inline(name, def){
|
||||
blocks[name] = inlines[name] = md[name] = def;
|
||||
}
|
||||
function block(name, def){
|
||||
blocks[name] = md[name] = def;
|
||||
}
|
||||
|
||||
|
||||
var langAliases = {
|
||||
'markup': [ 'markup', 'html', 'xml' ],
|
||||
'javascript': [ 'javascript', 'js' ]
|
||||
};
|
||||
|
||||
for(var i in Prism['languages']){
|
||||
if(!Prism['languages'].hasOwnProperty(i)) continue;
|
||||
var l = Prism['languages'][i];
|
||||
if(typeof l === 'function') continue;
|
||||
|
||||
var aliases = langAliases[i];
|
||||
var matches = aliases ? aliases.join('|') : i;
|
||||
|
||||
block('code-block fenced ' + i, {
|
||||
'pattern': new RegExp('(^ {0,3}|\\n {0,3})(([`~])\\3\\3) *(' + matches + ')( [^`\n]*)? *\\n(?:[\\s\\S]*?)\\n {0,3}(\\2\\3*(?= *\\n)|$)', 'gi'),
|
||||
'lookbehind': true,
|
||||
'inside': {
|
||||
'code-language': {
|
||||
'pattern': /(^([`~])\2+)((?!\2)[^\2\n])+/,
|
||||
'lookbehind': true
|
||||
},
|
||||
'marker code-fence start': /^([`~])\1+/,
|
||||
'marker code-fence end': /([`~])\1+$/,
|
||||
'code-inner': {
|
||||
'pattern': /(^\n)[\s\S]*(?=\n$)/,
|
||||
'lookbehind': true,
|
||||
'alias': 'language-' + i,
|
||||
'inside': l
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
block('code-block fenced untagged', {
|
||||
'pattern': /(^ {0,3}|\n {0,3})(([`~])\3\3)[^`\n]*\n(?:[\s\S]*?)\n {0,3}(\2\3*(?= *\n)|$)/g,
|
||||
'lookbehind': true,
|
||||
'inside': {
|
||||
'code-language': {
|
||||
'pattern': /(^([`~])\2+)((?!\2)[^\2\n])+/,
|
||||
'lookbehind': true
|
||||
},
|
||||
'marker code-fence start': /^([`~])\1+/,
|
||||
'marker code-fence end': /([`~])\1+$/,
|
||||
'code-inner': {
|
||||
'pattern': /(^\n)[\s\S]*(?=\n$)/,
|
||||
'lookbehind': true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
block('heading setext-heading heading-1', {
|
||||
'pattern': /^ {0,3}[^\s].*\n {0,3}=+[ \t]*$/gm,
|
||||
'inside': {
|
||||
'marker heading-setext-line': {
|
||||
'pattern': /^( {0,3}[^\s].*\n) {0,3}=+[ \t]*$/gm,
|
||||
'lookbehind': true
|
||||
},
|
||||
'rest': inlines
|
||||
}
|
||||
});
|
||||
|
||||
block('heading setext-heading heading-2', {
|
||||
'pattern': /^ {0,3}[^\s].*\n {0,3}-+[ \t]*$/gm,
|
||||
'inside': {
|
||||
'marker heading-setext-line': {
|
||||
'pattern': /^( {0,3}[^\s].*\n) {0,3}-+[ \t]*$/gm,
|
||||
'lookbehind': true
|
||||
},
|
||||
'rest': inlines
|
||||
}
|
||||
});
|
||||
|
||||
var headingInside = {
|
||||
'marker heading-hash start': /^ *#+ */,
|
||||
'marker heading-hash end': / +#+ *$/,
|
||||
'rest': inlines
|
||||
};
|
||||
for(var i = 1; i <= 6; i += 1){
|
||||
block('heading heading-'+i, {
|
||||
'pattern': new RegExp('^ {0,3}#{'+i+'}(?![#\\S]).*$', 'gm'),
|
||||
'inside': headingInside
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
var linkText = {
|
||||
'pattern': /^\[(?:\\.|[^\[\]]|\[[^\[\]]*\])*\]/,
|
||||
'inside': {
|
||||
'marker bracket start': /^\[/,
|
||||
'marker bracket end': /\]$/,
|
||||
'link-text-inner': {
|
||||
'pattern': /[\w\W]+/,
|
||||
'inside': inlines
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var linkLabel = {
|
||||
'pattern': /\[(?:\\.|[^\]])*\]/,
|
||||
'inside': {
|
||||
'marker bracket start': /^\[/,
|
||||
'marker bracket end': /\]$/,
|
||||
'link-label-inner': /[\w\W]+/
|
||||
}
|
||||
};
|
||||
|
||||
var imageText = {
|
||||
'pattern': /^!\[(?:\\.|[^\[\]]|\[[^\[\]]*\])*\]/,
|
||||
'inside': {
|
||||
'marker image-bang': /^!/,
|
||||
'marker bracket start': /^\[/,
|
||||
'marker bracket end': /\]$/,
|
||||
'image-text-inner': {
|
||||
'pattern': /[\w\W]+/,
|
||||
'inside': inlines
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var linkURL = {
|
||||
'pattern': /^(\s*)(?!<)(?:\\.|[^\(\)\s]|\([^\(\)\s]*\))+/,
|
||||
'lookbehind': true
|
||||
};
|
||||
|
||||
var linkBracedURL = {
|
||||
'pattern': /^(\s*)<(?:\\.|[^<>\n])*>/,
|
||||
'lookbehind': true,
|
||||
'inside': {
|
||||
'marker brace start': /^</,
|
||||
'marker brace end': />$/,
|
||||
'braced-href-inner': /[\w\W]+/
|
||||
}
|
||||
};
|
||||
|
||||
var linkTitle = {
|
||||
'pattern': /('(?:\\'|[^'])+'|"(?:\\"|[^"])+")\s*$/,
|
||||
// 'lookbehind': true,
|
||||
'inside': {
|
||||
'marker quote start': /^['"]/,
|
||||
'marker quote end': /['"]$/,
|
||||
'title-inner': /[\w\W]+/
|
||||
}
|
||||
};
|
||||
|
||||
var linkParams = {
|
||||
'pattern': /\( *(?:(?!<)(?:\\.|[^\(\)\s]|\([^\(\)\s]*\))*|<(?:[^<>\n]|\\.)*>)( +('(?:[^']|\\')+'|"(?:[^"]|\\")+"))? *\)/,
|
||||
'inside': {
|
||||
'marker bracket start': /^\(/,
|
||||
'marker bracket end': /\)$/,
|
||||
'link-params-inner': {
|
||||
'pattern': /[\w\W]+/,
|
||||
'inside': {
|
||||
'link-title': linkTitle,
|
||||
'href': linkURL,
|
||||
'braced-href': linkBracedURL
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
block('hr', {
|
||||
'pattern': /^[\t ]*([*\-_])([\t ]*\1){2,}([\t ]*$)/gm,
|
||||
'inside': {
|
||||
'marker hr-marker': /[*\-_]/g
|
||||
}
|
||||
});
|
||||
|
||||
block('urldef', {
|
||||
'pattern': /^( {0,3})\[(?:\\.|[^\]])+]: *\n? *(?:(?!<)(?:\\.|[^\(\)\s]|\([^\(\)\s]*\))*|<(?:[^<>\n]|\\.)*>)( *\n? *('(?:\\'|[^'])+'|"(?:\\"|[^"])+"))?$/gm,
|
||||
'lookbehind': true,
|
||||
'inside': {
|
||||
'link-label': linkLabel,
|
||||
'marker urldef-colon': /^:/,
|
||||
'link-title': linkTitle,
|
||||
'href': linkURL,
|
||||
'braced-href': linkBracedURL
|
||||
}
|
||||
});
|
||||
|
||||
block('blockquote', {
|
||||
'pattern': /^[\t ]*>[\t ]?.+(?:\n(?!\n)|.)*/gm,
|
||||
'inside': {
|
||||
'marker quote-marker': /^[\t ]*>[\t ]?/gm,
|
||||
'blockquote-content': {
|
||||
'pattern': /[^>]+/,
|
||||
'inside': {
|
||||
'rest': blocks
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
block('list', {
|
||||
'pattern': /^[\t ]*([*+\-]|\d+\.)[\t ].+(?:\n(?!\n)|.)*/gm,
|
||||
'inside': {
|
||||
'li': {
|
||||
'pattern': /^[\t ]*([*+\-]|\d+\.)[\t ].+(?:\n|[ \t]+[^*+\- \t].*\n)*/gm,
|
||||
'inside': {
|
||||
'marker list-item': /^[ \t]*([*+\-]|\d+\.)[ \t]/m,
|
||||
'rest': blocks
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
block('code-block indented', {
|
||||
'pattern': /(^|(?:^|(?:^|\n)(?![ \t]*([*+\-]|\d+\.)[ \t]).*\n)\s*?\n)((?: {4}|\t).*(?:\n|$))+/g,
|
||||
'lookbehind': true
|
||||
});
|
||||
|
||||
block('p', {
|
||||
'pattern': /[^\n](?:\n(?!\n)|.)*[^\n]/g,
|
||||
'inside': inlines
|
||||
});
|
||||
|
||||
inline('image', {
|
||||
'pattern': /(^|[^\\])!\[(?:\\.|[^\[\]]|\[[^\[\]]*\])*\]\(\s*(?:(?!<)(?:\\.|[^\(\)\s]|\([^\(\)\s]*\))*|<(?:[^<>\n]|\\.)*>)(\s+('(?:[^']|\\')+'|"(?:[^"]|\\")+"))?\s*\)/,
|
||||
'lookbehind': true,
|
||||
'inside': {
|
||||
'link-text': imageText,
|
||||
'link-params': linkParams
|
||||
}
|
||||
});
|
||||
|
||||
inline('link', {
|
||||
'pattern': /(^|[^\\])\[(?:\\.|[^\[\]]|\[[^\[\]]*\])*\]\(\s*(?:(?!<)(?:\\.|[^\(\)\s]|\([^\(\)\s]*\))*|<(?:[^<>\n]|\\.)*>)(\s+('(?:[^']|\\')+'|"(?:[^"]|\\")+"))?\s*\)/,
|
||||
'lookbehind': true,
|
||||
'inside': {
|
||||
'link-text': linkText,
|
||||
'link-params': linkParams
|
||||
}
|
||||
});
|
||||
|
||||
inline('image image-ref', {
|
||||
'pattern': /(^|[^\\])!\[(?:\\.|[^\[\]]|\[[^\[\]]*\])*\] ?\[(?:\\.|[^\]])*\]/,
|
||||
'lookbehind': true,
|
||||
'inside': {
|
||||
'link-text': imageText,
|
||||
'link-label': linkLabel
|
||||
}
|
||||
});
|
||||
inline('link link-ref', {
|
||||
'pattern': /(^|[^\\])\[(?:\\.|[^\[\]]|\[[^\[\]]*\])*\] ?\[(?:\\.|[^\]])*\]/,
|
||||
'lookbehind': true,
|
||||
'inside': {
|
||||
'link-text': linkText,
|
||||
'link-label': linkLabel
|
||||
}
|
||||
});
|
||||
|
||||
inline('image image-ref shortcut-ref', {
|
||||
'pattern': /(^|[^\\])!\[(?:\\.|[^\[\]]|\[[^\[\]]*\])*\]/,
|
||||
'lookbehind': true,
|
||||
'inside': {
|
||||
'marker image-bang': /^!/,
|
||||
'link-text': linkText
|
||||
}
|
||||
});
|
||||
inline('link link-ref shortcut-ref', {
|
||||
'pattern': /(^|[^\\])\[(?:\\.|[^\[\]]|\[[^\[\]]*\])*\]/,
|
||||
'lookbehind': true,
|
||||
'inside': {
|
||||
'link-text': linkText
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
inline('code', {
|
||||
'pattern': /(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/g,
|
||||
'lookbehind': true,
|
||||
'inside': {
|
||||
'marker code-marker start': /^`/,
|
||||
'marker code-marker end': /`$/,
|
||||
'code-inner': /[\w\W]+/
|
||||
}
|
||||
});
|
||||
|
||||
inline('strong', {
|
||||
'pattern': /(^|[^\\*_]|\\[*_])([_\*])\2(?:\n(?!\n)|.)+?\2{2}(?!\2)/g,
|
||||
// 'pattern': /(^|[^\\])(\*\*|__)(?:\n(?!\n)|.)+?\2/,
|
||||
'lookbehind': true,
|
||||
'inside': {
|
||||
'marker strong-marker start': /^(\*\*|__)/,
|
||||
'marker strong-marker end': /(\*\*|__)$/,
|
||||
'strong-inner': {
|
||||
'pattern': /[\w\W]+/,
|
||||
'inside': inlines
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
inline('em', {
|
||||
// 'pattern': /(^|[^\\])(\*|_)(\S[^\2]*?)??[^\s\\]+?\2/g,
|
||||
'pattern': /(^|[^\\*_]|\\[*_])(\*|_)(?:\n(?!\n)|.)+?\2(?!\2)/g,
|
||||
'lookbehind': true,
|
||||
'inside': {
|
||||
'marker em-marker start': /^(\*|_)/,
|
||||
'marker em-marker end': /(\*|_)$/,
|
||||
'em-inner': {
|
||||
'pattern': /[\w\W]+/,
|
||||
'inside': inlines
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
inline('strike', {
|
||||
'pattern': /(^|\n|(?!\\)\W)(~~)(?=\S)([^\r]*?\S)\2/gm,
|
||||
'lookbehind': true,
|
||||
'inside': {
|
||||
'marker strike-marker start': /^~~/,
|
||||
'marker strike-marker end': /~~$/,
|
||||
'strike-inner': {
|
||||
'pattern': /[\w\W]+/,
|
||||
'inside': inlines
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
inline('comment', Prism['languages']['markup']['comment']);
|
||||
|
||||
var tag = Prism['languages']['markup']['tag'];
|
||||
var tagMatch = tag['pattern'];
|
||||
|
||||
inline('tag', {
|
||||
'pattern': new RegExp("(^|[^\\\\])" + tagMatch.source, 'i'),
|
||||
'lookbehind': true,
|
||||
'inside': tag['inside']
|
||||
});
|
||||
inline('entity', Prism['languages']['markup']['entity']);
|
||||
|
||||
return md;
|
||||
})();
|
|
@ -1,13 +0,0 @@
|
|||
var evt = {
|
||||
bind: function(el, evt, fn){
|
||||
el.addEventListener(evt, fn, false);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function spliceString(str, i, remove, add){
|
||||
remove = +remove || 0;
|
||||
add = add || '';
|
||||
|
||||
return str.slice(0,i) + add + str.slice(i+remove);
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
var yaml = {
|
||||
'scalar': {
|
||||
'pattern': /([\-:]\s*(![^\s]+)?[ \t]*[|>])[ \t]*(?:(\n[ \t]+)[^\r\n]+(?:\3[^\r\n]+)*)/,
|
||||
'lookbehind': true,
|
||||
'alias': 'string'
|
||||
},
|
||||
'comment': /#[^\n]+/,
|
||||
'key': {
|
||||
'pattern': /(\s*[:\-,[{\n?][ \t]*(![^\s]+)?[ \t]*)[^\n{[\]},#]+?(?=\s*:\s)/,
|
||||
'lookbehind': true,
|
||||
'alias': 'atrule'
|
||||
},
|
||||
'directive': {
|
||||
'pattern': /((^|\n)[ \t]*)%[^\n]+/,
|
||||
'lookbehind': true,
|
||||
'alias': 'important'
|
||||
},
|
||||
'datetime': {
|
||||
'pattern': /([:\-,[{]\s*(![^\s]+)?[ \t]*)(\d{4}-\d\d?-\d\d?([tT]|[ \t]+)\d\d?:\d{2}:\d{2}(\.\d*)?[ \t]*(Z|[-+]\d\d?(:\d{2})?)?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(:\d{2}(\.\d*)?)?)(?=[ \t]*(\n|$|,|]|}))/,
|
||||
'lookbehind': true,
|
||||
'alias': 'number'
|
||||
},
|
||||
'boolean': {
|
||||
'pattern': /([:\-,[{]\s*(![^\s]+)?[ \t]*)(true|false)[ \t]*(?=\n|$|,|]|})/i,
|
||||
'lookbehind': true,
|
||||
'alias': 'important'
|
||||
},
|
||||
'null': {
|
||||
'pattern': /([:\-,[{]\s*(![^\s]+)?[ \t]*)(null|~)[ \t]*(?=\n|$|,|]|})/i,
|
||||
'lookbehind': true,
|
||||
'alias': 'important'
|
||||
},
|
||||
'string': {
|
||||
'pattern': /([:\-,[{]\s*(![^\s]+)?[ \t]*)("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')(?=[ \t]*(\n|$|,|]|}))/,
|
||||
'lookbehind': true
|
||||
},
|
||||
'number': {
|
||||
'pattern': /([:\-,[{]\s*(![^\s]+)?[ \t]*)[+\-]?(0x[\dA-Fa-f]+|0o[0-7]+|(\d+\.?\d*|\.?\d+)(e[\+\-]?\d+)?|\.inf|\.nan)[ \t]*(?=\n|$|,|]|})/i,
|
||||
'lookbehind': true
|
||||
},
|
||||
'tag': /![^\s]+/,
|
||||
'important': /[&*][\w]+/,
|
||||
'punctuation': /([:[\]{}\-,|>?]|---|\.\.\.)/
|
||||
};
|
|
@ -1,40 +0,0 @@
|
|||
{
|
||||
"name": "prism",
|
||||
"main": [
|
||||
"prism.js",
|
||||
"themes/prism.css"
|
||||
],
|
||||
"homepage": "http://prismjs.com",
|
||||
"authors": "Lea Verou",
|
||||
"description": "Lightweight, robust, elegant syntax highlighting. A spin-off project from Dabblet.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PrismJS/prism.git"
|
||||
},
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"img",
|
||||
"templates",
|
||||
"CNAME",
|
||||
"*.html",
|
||||
"style.css",
|
||||
"favicon.png",
|
||||
"logo.svg",
|
||||
"download.js",
|
||||
"prefixfree.min.js",
|
||||
"utopia.js",
|
||||
"code.js"
|
||||
],
|
||||
"version": "1.0.1",
|
||||
"_release": "1.0.1",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.1",
|
||||
"commit": "ed9d7e354c20a95755af7641e3a2a0c77a713791"
|
||||
},
|
||||
"_source": "git://github.com/LeaVerou/prism.git",
|
||||
"_target": "~1.0.1",
|
||||
"_originalSource": "prism",
|
||||
"_direct": true
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
# [Prism](http://prismjs.com/)
|
||||
|
||||
Prism is a lightweight, robust, elegant syntax highlighting library. It's a spin-off project from [Dabblet](http://dabblet.com/).
|
||||
|
||||
You can learn more on http://prismjs.com/.
|
||||
|
||||
Why another syntax highlighter?: http://lea.verou.me/2012/07/introducing-prism-an-awesome-new-syntax-highlighter/#more-1841
|
||||
|
||||
## Contribute to Prism!
|
||||
|
||||
Prism depends on community contributions to expand and cover a wider array of use cases. If you like it, considering giving back by sending a pull request. Here are a few tips:
|
||||
|
||||
- Read the [documentation](http://prismjs.com/extending.html). Prism was designed to be extensible.
|
||||
- Do not edit prism.js, it’s just the version of Prism used by the Prism website and is built automatically. Limit your changes to the unminified files in the components/ folder. The minified files are also generated automatically.
|
||||
- Currently the build system building prism.js and the minified files is just a bunch of local settings in CodeKit. If someone wants to help export them to a config file, please contact me by opening an issue.
|
||||
- Please follow the code conventions used in the files already. For example, I use [tabs for indentation and spaces for alignment](http://lea.verou.me/2012/01/why-tabs-are-clearly-superior/). Opening braces are on the same line, closing braces on their own line regardless of construct. There is a space before the opening brace. etc etc.
|
||||
- Please try to err towards more smaller PRs rather than few huge PRs. If a PR includes changes I want to merge and changes I don't, handling it becomes difficult.
|
||||
- My time is very limited these days, so it might take a long time to review longer PRs (short ones are usually merged very quickly), especially those modifying the Prism Core. This doesn't mean your PR is rejected.
|
||||
- If you contribute a new language definition, you will be responsible for handling bug reports about that language definition. Soon I plan to add usernames of project owners for themes, plugins and language definitions so this becomes more clear to users.
|
||||
- If you add a new language definition, theme or plugin, you need to add it to `components.js` as well, so that it becomes available to the download build page.
|
||||
|
||||
Thank you so much for contributing!!
|
|
@ -1,29 +0,0 @@
|
|||
{
|
||||
"name": "prism",
|
||||
"main": [
|
||||
"prism.js",
|
||||
"themes/prism.css"
|
||||
],
|
||||
"homepage": "http://prismjs.com",
|
||||
"authors": "Lea Verou",
|
||||
"description": "Lightweight, robust, elegant syntax highlighting. A spin-off project from Dabblet.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PrismJS/prism.git"
|
||||
},
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"img",
|
||||
"templates",
|
||||
"CNAME",
|
||||
"*.html",
|
||||
"style.css",
|
||||
"favicon.png",
|
||||
"logo.svg",
|
||||
"download.js",
|
||||
"prefixfree.min.js",
|
||||
"utopia.js",
|
||||
"code.js"
|
||||
]
|
||||
}
|
|
@ -1,382 +0,0 @@
|
|||
var components = {
|
||||
"core": {
|
||||
"meta": {
|
||||
"path": "components/prism-core.js",
|
||||
"option": "mandatory"
|
||||
},
|
||||
"core": "Core"
|
||||
},
|
||||
"themes": {
|
||||
"meta": {
|
||||
"path": "themes/{id}.css",
|
||||
"link": "index.html?theme={id}",
|
||||
"exclusive": true
|
||||
},
|
||||
"prism": {
|
||||
"title": "Default",
|
||||
"option": "default"
|
||||
},
|
||||
"prism-dark": "Dark",
|
||||
"prism-funky": "Funky",
|
||||
"prism-okaidia": {
|
||||
"title": "Okaidia",
|
||||
"owner": "ocodia"
|
||||
},
|
||||
"prism-twilight": {
|
||||
"title": "Twilight",
|
||||
"owner": "remybach"
|
||||
},
|
||||
"prism-coy": {
|
||||
"title": "Coy",
|
||||
"owner": "tshedor"
|
||||
}
|
||||
},
|
||||
"languages": {
|
||||
"meta": {
|
||||
"path": "components/prism-{id}",
|
||||
"noCSS": true,
|
||||
"examplesPath": "examples/prism-{id}"
|
||||
},
|
||||
"markup": {
|
||||
"title": "Markup",
|
||||
"option": "default"
|
||||
},
|
||||
"css": {
|
||||
"title": "CSS",
|
||||
"option": "default"
|
||||
},
|
||||
"clike": {
|
||||
"title": "C-like",
|
||||
"option": "default"
|
||||
},
|
||||
"javascript": {
|
||||
"title": "JavaScript",
|
||||
"option": "default",
|
||||
"require": "clike"
|
||||
},
|
||||
|
||||
// ---
|
||||
|
||||
"actionscript": {
|
||||
"title": "ActionScript",
|
||||
"require": "javascript",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"apacheconf": {
|
||||
"title": "Apache Configuration",
|
||||
"owner": "GuiTeK"
|
||||
},
|
||||
"applescript": {
|
||||
"title": "AppleScript",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"aspnet": {
|
||||
"title": "ASP.NET (C#)",
|
||||
"require": "markup",
|
||||
"owner": "nauzilus"
|
||||
},
|
||||
"autohotkey": {
|
||||
"title": "AutoHotkey",
|
||||
"owner": "aviaryan"
|
||||
},
|
||||
"bash": {
|
||||
"title": "Bash",
|
||||
"require": "clike",
|
||||
"owner": "zeitgeist87"
|
||||
},
|
||||
"brainfuck": {
|
||||
"title": "Brainfuck",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"c": {
|
||||
"title": "C",
|
||||
"require": "clike",
|
||||
"owner": "zeitgeist87"
|
||||
},
|
||||
"csharp": {
|
||||
"title": "C#",
|
||||
"require": "clike",
|
||||
"owner": "mvalipour"
|
||||
},
|
||||
"cpp": {
|
||||
"title": "C++",
|
||||
"require": "c",
|
||||
"owner": "zeitgeist87"
|
||||
},
|
||||
"coffeescript": {
|
||||
"title": "CoffeeScript",
|
||||
"require": "javascript",
|
||||
"owner": "R-osey"
|
||||
},
|
||||
"css-extras": {
|
||||
"title": "CSS Extras",
|
||||
"require": "css",
|
||||
"owner": "milesj"
|
||||
},
|
||||
"dart": {
|
||||
"title": "Dart",
|
||||
"require": "clike",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"eiffel": {
|
||||
"title": "Eiffel",
|
||||
"owner": "Conaclos"
|
||||
},
|
||||
"erlang": {
|
||||
"title": "Erlang",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"fsharp": {
|
||||
"title": "F#",
|
||||
"require": "clike",
|
||||
"owner": "simonreynolds7"
|
||||
},
|
||||
"fortran": {
|
||||
"title": "Fortran",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"gherkin": {
|
||||
"title": "Gherkin",
|
||||
"owner": "hason"
|
||||
},
|
||||
"git": {
|
||||
"title": "Git",
|
||||
"owner": "lgiraudel"
|
||||
},
|
||||
"go": {
|
||||
"title": "Go",
|
||||
"require": "clike",
|
||||
"owner": "arnehormann"
|
||||
},
|
||||
"groovy": {
|
||||
"title": "Groovy",
|
||||
"require": "clike",
|
||||
"owner": "robfletcher"
|
||||
},
|
||||
"haml": {
|
||||
"title": "Haml",
|
||||
"require": "ruby",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"handlebars": {
|
||||
"title": "Handlebars",
|
||||
"require": "markup",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"haskell": {
|
||||
"title": "Haskell",
|
||||
"owner": "bholst"
|
||||
},
|
||||
"http": {
|
||||
"title": "HTTP",
|
||||
"owner": "danielgtaylor"
|
||||
},
|
||||
"ini": {
|
||||
"title": "Ini",
|
||||
"owner": "aviaryan"
|
||||
},
|
||||
"jade": {
|
||||
"title": "Jade",
|
||||
"require": "javascript",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"java": {
|
||||
"title": "Java",
|
||||
"require": "clike",
|
||||
"owner": "sherblot"
|
||||
},
|
||||
"julia": {
|
||||
"title": "Julia",
|
||||
"owner": "cdagnino"
|
||||
},
|
||||
"keyman": {
|
||||
"title": "Keyman",
|
||||
"owner": "mcdurdin"
|
||||
},
|
||||
"latex": {
|
||||
"title": "LaTeX",
|
||||
"owner": "japborst"
|
||||
},
|
||||
"less": {
|
||||
"title": "Less",
|
||||
"require": "css",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"lolcode": {
|
||||
"title": "LOLCODE",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"makefile": {
|
||||
"title": "Makefile",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"markdown": {
|
||||
"title": "Markdown",
|
||||
"require": "markup",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"matlab": {
|
||||
"title": "MATLAB",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"nasm": {
|
||||
"title": "NASM",
|
||||
"owner": "rbmj"
|
||||
},
|
||||
"nsis": {
|
||||
"title": "NSIS",
|
||||
"owner": "idleberg"
|
||||
},
|
||||
"objectivec": {
|
||||
"title": "Objective-C",
|
||||
"require": "c",
|
||||
"owner": "uranusjr"
|
||||
},
|
||||
"pascal": {
|
||||
"title": "Pascal",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"perl": {
|
||||
"title": "Perl",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"php": {
|
||||
"title": "PHP",
|
||||
"require": "clike",
|
||||
"owner": "milesj"
|
||||
},
|
||||
"php-extras": {
|
||||
"title": "PHP Extras",
|
||||
"require": "php",
|
||||
"owner": "milesj"
|
||||
},
|
||||
"powershell": {
|
||||
"title": "PowerShell",
|
||||
"owner": "nauzilus"
|
||||
},
|
||||
"python": {
|
||||
"title": "Python",
|
||||
"owner": "multipetros"
|
||||
},
|
||||
"r": {
|
||||
"title": "R",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"jsx":{
|
||||
"title": "React JSX",
|
||||
"require": ["markup", "javascript"],
|
||||
"owner": "vkbansal"
|
||||
},
|
||||
"rest": {
|
||||
"title": "reST (reStructuredText)",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"rip": {
|
||||
"title": "Rip",
|
||||
"owner": "ravinggenius"
|
||||
},
|
||||
"ruby": {
|
||||
"title": "Ruby",
|
||||
"require": "clike",
|
||||
"owner": "samflores"
|
||||
},
|
||||
"rust": {
|
||||
"title": "Rust",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"sas": {
|
||||
"title": "SAS",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"sass": {
|
||||
"title": "Sass (Sass)",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"scss": {
|
||||
"title": "Sass (Scss)",
|
||||
"require": "css",
|
||||
"owner": "MoOx"
|
||||
},
|
||||
"scala": {
|
||||
"title": "Scala",
|
||||
"require": "java",
|
||||
"owner": "jozic"
|
||||
},
|
||||
"scheme" : {
|
||||
"title": "Scheme",
|
||||
"owner" : "bacchus123"
|
||||
},
|
||||
"smalltalk": {
|
||||
"title": "Smalltalk",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"smarty": {
|
||||
"title": "Smarty",
|
||||
"require": "markup",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"sql": {
|
||||
"title": "SQL",
|
||||
"owner": "multipetros"
|
||||
},
|
||||
"stylus" : {
|
||||
"title": "Stylus",
|
||||
"owner": "vkbansal"
|
||||
},
|
||||
"swift": {
|
||||
"title": "Swift",
|
||||
"require": "clike",
|
||||
"owner": "chrischares"
|
||||
},
|
||||
"twig": {
|
||||
"title": "Twig",
|
||||
"require": "markup",
|
||||
"owner": "brandonkelly"
|
||||
},
|
||||
"typescript":{
|
||||
"title": "TypeScript",
|
||||
"require": "javascript",
|
||||
"owner": "vkbansal"
|
||||
},
|
||||
"vhdl": {
|
||||
"title": "VHDL",
|
||||
"owner": "a-rey"
|
||||
},
|
||||
"wiki": {
|
||||
"title": "Wiki markup",
|
||||
"require": "markup",
|
||||
"owner": "Golmote"
|
||||
},
|
||||
"yaml": {
|
||||
"title": "YAML",
|
||||
"owner": "hason"
|
||||
}
|
||||
},
|
||||
"plugins": {
|
||||
"meta": {
|
||||
"path": "plugins/{id}/prism-{id}",
|
||||
"link": "plugins/{id}/"
|
||||
},
|
||||
"line-highlight": "Line Highlight",
|
||||
"line-numbers": {
|
||||
"title": "Line Numbers",
|
||||
"owner": "kuba-kubula"
|
||||
},
|
||||
"show-invisibles": "Show Invisibles",
|
||||
"autolinker": "Autolinker",
|
||||
"wpd": "WebPlatform Docs",
|
||||
"file-highlight": {
|
||||
"title": "File Highlight",
|
||||
"noCSS": true
|
||||
},
|
||||
"show-language": {
|
||||
"title": "Show Language",
|
||||
"owner": "nauzilus"
|
||||
},
|
||||
"highlight-keywords": {
|
||||
"title": "Highlight Keywords",
|
||||
"owner": "vkbansal",
|
||||
"noCSS": true
|
||||
}
|
||||
}
|
||||
};
|
|
@ -1,17 +0,0 @@
|
|||
Prism.languages.actionscript = Prism.languages.extend('javascript', {
|
||||
'keyword': /\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with|dynamic|each|final|get|include|namespace|native|override|set|static)\b/,
|
||||
'operator': /\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/
|
||||
});
|
||||
Prism.languages.actionscript['class-name'].alias = 'function';
|
||||
|
||||
if (Prism.languages.markup) {
|
||||
Prism.languages.insertBefore('actionscript', 'string', {
|
||||
'xml': {
|
||||
pattern: /(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\\1|\\?(?!\1)[\w\W])*\2)*\s*\/?>/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.markup
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.actionscript=Prism.languages.extend("javascript",{keyword:/\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with|dynamic|each|final|get|include|namespace|native|override|set|static)\b/,operator:/\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/}),Prism.languages.actionscript["class-name"].alias="function",Prism.languages.markup&&Prism.languages.insertBefore("actionscript","string",{xml:{pattern:/(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\\1|\\?(?!\1)[\w\W])*\2)*\s*\/?>/,lookbehind:!0,inside:{rest:Prism.languages.markup}}});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,20 +0,0 @@
|
|||
Prism.languages.applescript = {
|
||||
'comment': [
|
||||
// Allow one level of nesting
|
||||
/\(\*(?:\(\*[\w\W]*?\*\)|[\w\W])*?\*\)/,
|
||||
/--.+/,
|
||||
/#.+/
|
||||
],
|
||||
'string': /"(?:\\?.)*?"/,
|
||||
'number': /\b-?\d*\.?\d+([Ee]-?\d+)?\b/,
|
||||
'operator': [
|
||||
/[&=≠≤≥*+\-\/÷^]|[<>]=?/,
|
||||
/\b(?:(?:start|begin|end)s? with|(?:(?:does not|doesn't) contain|contains?)|(?:is|isn't|is not) (?:in|contained by)|(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?|(?:(?:does not|doesn't) come|comes) (?:before|after)|(?:is|isn't|is not) equal(?: to)?|(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)|(?:a )?(?:ref(?: to)?|reference to)|(?:and|or|div|mod|as|not))\b/
|
||||
],
|
||||
'keyword': /\b(?:about|above|after|against|apart from|around|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|continue|copy|does|eighth|else|end|equal|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|my|ninth|of|on|onto|out of|over|prop|property|put|repeat|return|returning|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/,
|
||||
'class': {
|
||||
pattern: /\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text|centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/,
|
||||
alias: 'builtin'
|
||||
},
|
||||
'punctuation': /[{}():,¬«»《》]/
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.applescript={comment:[/\(\*(?:\(\*[\w\W]*?\*\)|[\w\W])*?\*\)/,/--.+/,/#.+/],string:/"(?:\\?.)*?"/,number:/\b-?\d*\.?\d+([Ee]-?\d+)?\b/,operator:[/[&=≠≤≥*+\-\/÷^]|[<>]=?/,/\b(?:(?:start|begin|end)s? with|(?:(?:does not|doesn't) contain|contains?)|(?:is|isn't|is not) (?:in|contained by)|(?:(?:is|isn't|is not) )?(?:greater|less) than(?: or equal)?(?: to)?|(?:(?:does not|doesn't) come|comes) (?:before|after)|(?:is|isn't|is not) equal(?: to)?|(?:(?:does not|doesn't) equal|equals|equal to|isn't|is not)|(?:a )?(?:ref(?: to)?|reference to)|(?:and|or|div|mod|as|not))\b/],keyword:/\b(?:about|above|after|against|apart from|around|aside from|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|continue|copy|does|eighth|else|end|equal|error|every|exit|false|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|instead of|into|is|it|its|last|local|me|middle|my|ninth|of|on|onto|out of|over|prop|property|put|repeat|return|returning|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|true|try|until|where|while|whose|with|without)\b/,"class":{pattern:/\b(?:alias|application|boolean|class|constant|date|file|integer|list|number|POSIX file|real|record|reference|RGB color|script|text|centimetres|centimeters|feet|inches|kilometres|kilometers|metres|meters|miles|yards|square feet|square kilometres|square kilometers|square metres|square meters|square miles|square yards|cubic centimetres|cubic centimeters|cubic feet|cubic inches|cubic metres|cubic meters|cubic yards|gallons|litres|liters|quarts|grams|kilograms|ounces|pounds|degrees Celsius|degrees Fahrenheit|degrees Kelvin)\b/,alias:"builtin"},punctuation:/[{}():,¬«»《》]/};
|
|
@ -1,51 +0,0 @@
|
|||
Prism.languages.aspnet = Prism.languages.extend('markup', {
|
||||
'page-directive tag': {
|
||||
pattern: /<%\s*@.*%>/i,
|
||||
inside: {
|
||||
'page-directive tag': /<%\s*@\s*(?:Assembly|Control|Implements|Import|Master(?:Type)?|OutputCache|Page|PreviousPageType|Reference|Register)?|%>/i,
|
||||
rest: Prism.languages.markup.tag.inside
|
||||
}
|
||||
},
|
||||
'directive tag': {
|
||||
pattern: /<%.*%>/i,
|
||||
inside: {
|
||||
'directive tag': /<%\s*?[$=%#:]{0,2}|%>/i,
|
||||
rest: Prism.languages.csharp
|
||||
}
|
||||
}
|
||||
});
|
||||
// Regexp copied from prism-markup, with a negative look-ahead added
|
||||
Prism.languages.aspnet.tag.pattern = /<(?!%)\/?[^\s>\/]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i;
|
||||
|
||||
// match directives of attribute value foo="<% Bar %>"
|
||||
Prism.languages.insertBefore('inside', 'punctuation', {
|
||||
'directive tag': Prism.languages.aspnet['directive tag']
|
||||
}, Prism.languages.aspnet.tag.inside["attr-value"]);
|
||||
|
||||
Prism.languages.insertBefore('aspnet', 'comment', {
|
||||
'asp comment': /<%--[\w\W]*?--%>/
|
||||
});
|
||||
|
||||
// script runat="server" contains csharp, not javascript
|
||||
Prism.languages.insertBefore('aspnet', Prism.languages.javascript ? 'script' : 'tag', {
|
||||
'asp script': {
|
||||
pattern: /<script(?=.*runat=['"]?server['"]?)[\w\W]*?>[\w\W]*?<\/script>/i,
|
||||
inside: {
|
||||
tag: {
|
||||
pattern: /<\/?script\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/i,
|
||||
inside: Prism.languages.aspnet.tag.inside
|
||||
},
|
||||
rest: Prism.languages.csharp || {}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Hacks to fix eager tag matching finishing too early: <script src="<% Foo.Bar %>"> => <script src="<% Foo.Bar %>
|
||||
if ( Prism.languages.aspnet.style ) {
|
||||
Prism.languages.aspnet.style.inside.tag.pattern = /<\/?style\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/i;
|
||||
Prism.languages.aspnet.style.inside.tag.inside = Prism.languages.aspnet.tag.inside;
|
||||
}
|
||||
if ( Prism.languages.aspnet.script ) {
|
||||
Prism.languages.aspnet.script.inside.tag.pattern = Prism.languages.aspnet['asp script'].inside.tag.pattern;
|
||||
Prism.languages.aspnet.script.inside.tag.inside = Prism.languages.aspnet.tag.inside;
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.aspnet=Prism.languages.extend("markup",{"page-directive tag":{pattern:/<%\s*@.*%>/i,inside:{"page-directive tag":/<%\s*@\s*(?:Assembly|Control|Implements|Import|Master(?:Type)?|OutputCache|Page|PreviousPageType|Reference|Register)?|%>/i,rest:Prism.languages.markup.tag.inside}},"directive tag":{pattern:/<%.*%>/i,inside:{"directive tag":/<%\s*?[$=%#:]{0,2}|%>/i,rest:Prism.languages.csharp}}}),Prism.languages.aspnet.tag.pattern=/<(?!%)\/?[^\s>\/]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,Prism.languages.insertBefore("inside","punctuation",{"directive tag":Prism.languages.aspnet["directive tag"]},Prism.languages.aspnet.tag.inside["attr-value"]),Prism.languages.insertBefore("aspnet","comment",{"asp comment":/<%--[\w\W]*?--%>/}),Prism.languages.insertBefore("aspnet",Prism.languages.javascript?"script":"tag",{"asp script":{pattern:/<script(?=.*runat=['"]?server['"]?)[\w\W]*?>[\w\W]*?<\/script>/i,inside:{tag:{pattern:/<\/?script\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/i,inside:Prism.languages.aspnet.tag.inside},rest:Prism.languages.csharp||{}}}}),Prism.languages.aspnet.style&&(Prism.languages.aspnet.style.inside.tag.pattern=/<\/?style\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/i,Prism.languages.aspnet.style.inside.tag.inside=Prism.languages.aspnet.tag.inside),Prism.languages.aspnet.script&&(Prism.languages.aspnet.script.inside.tag.pattern=Prism.languages.aspnet["asp script"].inside.tag.pattern,Prism.languages.aspnet.script.inside.tag.inside=Prism.languages.aspnet.tag.inside);
|
|
@ -1,27 +0,0 @@
|
|||
// NOTES - follows first-first highlight method, block is locked after highlight, different from SyntaxHl
|
||||
Prism.languages.autohotkey= {
|
||||
'comment': {
|
||||
pattern: /(^[^";\n]*("[^"\n]*?"[^"\n]*?)*)(;.*$|^\s*\/\*[\s\S]*\n\*\/)/m,
|
||||
lookbehind: true
|
||||
},
|
||||
'string': /"(([^"\n\r]|"")*)"/m,
|
||||
'function': /[^\(\); \t,\n\+\*\-=\?>:\\\/<&%\[\]]+?(?=\()/m, //function - don't use .*\) in the end bcoz string locks it
|
||||
'tag': /^[ \t]*[^\s:]+?(?=:(?:[^:]|$))/m, //labels
|
||||
'variable': /%\w+%/,
|
||||
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/,
|
||||
'operator': /\?|\/\/?=?|:=|\|[=|]?|&[=&]?|\+[=+]?|-[=-]?|\*[=*]?|<(?:<=?|>|=)?|>>?=?|[.^!=~]=?|\b(?:AND|NOT|OR)\b/,
|
||||
'punctuation': /[\{}[\]\(\):,]/,
|
||||
'boolean': /\b(true|false)\b/,
|
||||
|
||||
'selector': /\b(AutoTrim|BlockInput|Break|Click|ClipWait|Continue|Control|ControlClick|ControlFocus|ControlGet|ControlGetFocus|ControlGetPos|ControlGetText|ControlMove|ControlSend|ControlSendRaw|ControlSetText|CoordMode|Critical|DetectHiddenText|DetectHiddenWindows|Drive|DriveGet|DriveSpaceFree|EnvAdd|EnvDiv|EnvGet|EnvMult|EnvSet|EnvSub|EnvUpdate|Exit|ExitApp|FileAppend|FileCopy|FileCopyDir|FileCreateDir|FileCreateShortcut|FileDelete|FileEncoding|FileGetAttrib|FileGetShortcut|FileGetSize|FileGetTime|FileGetVersion|FileInstall|FileMove|FileMoveDir|FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|FileRemoveDir|FileSelectFile|FileSelectFolder|FileSetAttrib|FileSetTime|FormatTime|GetKeyState|Gosub|Goto|GroupActivate|GroupAdd|GroupClose|GroupDeactivate|Gui|GuiControl|GuiControlGet|Hotkey|ImageSearch|IniDelete|IniRead|IniWrite|Input|InputBox|KeyWait|ListHotkeys|ListLines|ListVars|Loop|Menu|MouseClick|MouseClickDrag|MouseGetPos|MouseMove|MsgBox|OnExit|OutputDebug|Pause|PixelGetColor|PixelSearch|PostMessage|Process|Progress|Random|RegDelete|RegRead|RegWrite|Reload|Repeat|Return|Run|RunAs|RunWait|Send|SendEvent|SendInput|SendMessage|SendMode|SendPlay|SendRaw|SetBatchLines|SetCapslockState|SetControlDelay|SetDefaultMouseSpeed|SetEnv|SetFormat|SetKeyDelay|SetMouseDelay|SetNumlockState|SetScrollLockState|SetStoreCapslockMode|SetTimer|SetTitleMatchMode|SetWinDelay|SetWorkingDir|Shutdown|Sleep|Sort|SoundBeep|SoundGet|SoundGetWaveVolume|SoundPlay|SoundSet|SoundSetWaveVolume|SplashImage|SplashTextOff|SplashTextOn|SplitPath|StatusBarGetText|StatusBarWait|StringCaseSense|StringGetPos|StringLeft|StringLen|StringLower|StringMid|StringReplace|StringRight|StringSplit|StringTrimLeft|StringTrimRight|StringUpper|Suspend|SysGet|Thread|ToolTip|Transform|TrayTip|URLDownloadToFile|WinActivate|WinActivateBottom|WinClose|WinGet|WinGetActiveStats|WinGetActiveTitle|WinGetClass|WinGetPos|WinGetText|WinGetTitle|WinHide|WinKill|WinMaximize|WinMenuSelectItem|WinMinimize|WinMinimizeAll|WinMinimizeAllUndo|WinMove|WinRestore|WinSet|WinSetTitle|WinShow|WinWait|WinWaitActive|WinWaitClose|WinWaitNotActive)\b/i,
|
||||
|
||||
'constant': /\b(a_ahkpath|a_ahkversion|a_appdata|a_appdatacommon|a_autotrim|a_batchlines|a_caretx|a_carety|a_computername|a_controldelay|a_cursor|a_dd|a_ddd|a_dddd|a_defaultmousespeed|a_desktop|a_desktopcommon|a_detecthiddentext|a_detecthiddenwindows|a_endchar|a_eventinfo|a_exitreason|a_formatfloat|a_formatinteger|a_gui|a_guievent|a_guicontrol|a_guicontrolevent|a_guiheight|a_guiwidth|a_guix|a_guiy|a_hour|a_iconfile|a_iconhidden|a_iconnumber|a_icontip|a_index|a_ipaddress1|a_ipaddress2|a_ipaddress3|a_ipaddress4|a_isadmin|a_iscompiled|a_iscritical|a_ispaused|a_issuspended|a_isunicode|a_keydelay|a_language|a_lasterror|a_linefile|a_linenumber|a_loopfield|a_loopfileattrib|a_loopfiledir|a_loopfileext|a_loopfilefullpath|a_loopfilelongpath|a_loopfilename|a_loopfileshortname|a_loopfileshortpath|a_loopfilesize|a_loopfilesizekb|a_loopfilesizemb|a_loopfiletimeaccessed|a_loopfiletimecreated|a_loopfiletimemodified|a_loopreadline|a_loopregkey|a_loopregname|a_loopregsubkey|a_loopregtimemodified|a_loopregtype|a_mday|a_min|a_mm|a_mmm|a_mmmm|a_mon|a_mousedelay|a_msec|a_mydocuments|a_now|a_nowutc|a_numbatchlines|a_ostype|a_osversion|a_priorhotkey|programfiles|a_programfiles|a_programs|a_programscommon|a_screenheight|a_screenwidth|a_scriptdir|a_scriptfullpath|a_scriptname|a_sec|a_space|a_startmenu|a_startmenucommon|a_startup|a_startupcommon|a_stringcasesense|a_tab|a_temp|a_thisfunc|a_thishotkey|a_thislabel|a_thismenu|a_thismenuitem|a_thismenuitempos|a_tickcount|a_timeidle|a_timeidlephysical|a_timesincepriorhotkey|a_timesincethishotkey|a_titlematchmode|a_titlematchmodespeed|a_username|a_wday|a_windelay|a_windir|a_workingdir|a_yday|a_year|a_yweek|a_yyyy|clipboard|clipboardall|comspec|errorlevel)\b/i,
|
||||
|
||||
'builtin': /\b(abs|acos|asc|asin|atan|ceil|chr|class|cos|dllcall|exp|fileexist|Fileopen|floor|il_add|il_create|il_destroy|instr|substr|isfunc|islabel|IsObject|ln|log|lv_add|lv_delete|lv_deletecol|lv_getcount|lv_getnext|lv_gettext|lv_insert|lv_insertcol|lv_modify|lv_modifycol|lv_setimagelist|mod|onmessage|numget|numput|registercallback|regexmatch|regexreplace|round|sin|tan|sqrt|strlen|sb_seticon|sb_setparts|sb_settext|strsplit|tv_add|tv_delete|tv_getchild|tv_getcount|tv_getnext|tv_get|tv_getparent|tv_getprev|tv_getselection|tv_gettext|tv_modify|varsetcapacity|winactive|winexist|__New|__Call|__Get|__Set)\b/i,
|
||||
|
||||
'symbol': /\b(alt|altdown|altup|appskey|backspace|browser_back|browser_favorites|browser_forward|browser_home|browser_refresh|browser_search|browser_stop|bs|capslock|ctrl|ctrlbreak|ctrldown|ctrlup|del|delete|down|end|enter|esc|escape|f1|f10|f11|f12|f13|f14|f15|f16|f17|f18|f19|f2|f20|f21|f22|f23|f24|f3|f4|f5|f6|f7|f8|f9|home|ins|insert|joy1|joy10|joy11|joy12|joy13|joy14|joy15|joy16|joy17|joy18|joy19|joy2|joy20|joy21|joy22|joy23|joy24|joy25|joy26|joy27|joy28|joy29|joy3|joy30|joy31|joy32|joy4|joy5|joy6|joy7|joy8|joy9|joyaxes|joybuttons|joyinfo|joyname|joypov|joyr|joyu|joyv|joyx|joyy|joyz|lalt|launch_app1|launch_app2|launch_mail|launch_media|lbutton|lcontrol|lctrl|left|lshift|lwin|lwindown|lwinup|mbutton|media_next|media_play_pause|media_prev|media_stop|numlock|numpad0|numpad1|numpad2|numpad3|numpad4|numpad5|numpad6|numpad7|numpad8|numpad9|numpadadd|numpadclear|numpaddel|numpaddiv|numpaddot|numpaddown|numpadend|numpadenter|numpadhome|numpadins|numpadleft|numpadmult|numpadpgdn|numpadpgup|numpadright|numpadsub|numpadup|pgdn|pgup|printscreen|ralt|rbutton|rcontrol|rctrl|right|rshift|rwin|rwindown|rwinup|scrolllock|shift|shiftdown|shiftup|space|tab|up|volume_down|volume_mute|volume_up|wheeldown|wheelleft|wheelright|wheelup|xbutton1|xbutton2)\b/i,
|
||||
|
||||
'important': /#\b(AllowSameLineComments|ClipboardTimeout|CommentFlag|ErrorStdOut|EscapeChar|HotkeyInterval|HotkeyModifierTimeout|Hotstring|IfWinActive|IfWinExist|IfWinNotActive|IfWinNotExist|Include|IncludeAgain|InstallKeybdHook|InstallMouseHook|KeyHistory|LTrim|MaxHotkeysPerInterval|MaxMem|MaxThreads|MaxThreadsBuffer|MaxThreadsPerHotkey|NoEnv|NoTrayIcon|Persistent|SingleInstance|UseHook|WinActivateForce)\b/i,
|
||||
|
||||
'keyword': /\b(Abort|AboveNormal|Add|ahk_class|ahk_group|ahk_id|ahk_pid|All|Alnum|Alpha|AltSubmit|AltTab|AltTabAndMenu|AltTabMenu|AltTabMenuDismiss|AlwaysOnTop|AutoSize|Background|BackgroundTrans|BelowNormal|between|BitAnd|BitNot|BitOr|BitShiftLeft|BitShiftRight|BitXOr|Bold|Border|Button|ByRef|Checkbox|Checked|CheckedGray|Choose|ChooseString|Close|Color|ComboBox|Contains|ControlList|Count|Date|DateTime|Days|DDL|Default|DeleteAll|Delimiter|Deref|Destroy|Digit|Disable|Disabled|DropDownList|Edit|Eject|Else|Enable|Enabled|Error|Exist|Expand|ExStyle|FileSystem|First|Flash|Float|FloatFast|Focus|Font|for|global|Grid|Group|GroupBox|GuiClose|GuiContextMenu|GuiDropFiles|GuiEscape|GuiSize|Hdr|Hidden|Hide|High|HKCC|HKCR|HKCU|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_LOCAL_MACHINE|HKEY_USERS|HKLM|HKU|Hours|HScroll|Icon|IconSmall|ID|IDLast|If|IfEqual|IfExist|IfGreater|IfGreaterOrEqual|IfInString|IfLess|IfLessOrEqual|IfMsgBox|IfNotEqual|IfNotExist|IfNotInString|IfWinActive|IfWinExist|IfWinNotActive|IfWinNotExist|Ignore|ImageList|in|Integer|IntegerFast|Interrupt|is|italic|Join|Label|LastFound|LastFoundExist|Limit|Lines|List|ListBox|ListView|local|Lock|Logoff|Low|Lower|Lowercase|MainWindow|Margin|Maximize|MaximizeBox|MaxSize|Minimize|MinimizeBox|MinMax|MinSize|Minutes|MonthCal|Mouse|Move|Multi|NA|No|NoActivate|NoDefault|NoHide|NoIcon|NoMainWindow|norm|Normal|NoSort|NoSortHdr|NoStandard|Not|NoTab|NoTimers|Number|Off|Ok|On|OwnDialogs|Owner|Parse|Password|Picture|Pixel|Pos|Pow|Priority|ProcessName|Radio|Range|Read|ReadOnly|Realtime|Redraw|REG_BINARY|REG_DWORD|REG_EXPAND_SZ|REG_MULTI_SZ|REG_SZ|Region|Relative|Rename|Report|Resize|Restore|Retry|RGB|Screen|Seconds|Section|Serial|SetLabel|ShiftAltTab|Show|Single|Slider|SortDesc|Standard|static|Status|StatusBar|StatusCD|strike|Style|Submit|SysMenu|Tab2|TabStop|Text|Theme|Tile|ToggleCheck|ToggleEnable|ToolWindow|Top|Topmost|TransColor|Transparent|Tray|TreeView|TryAgain|Type|UnCheck|underline|Unicode|Unlock|UpDown|Upper|Uppercase|UseErrorLevel|Vis|VisFirst|Visible|VScroll|Wait|WaitClose|WantCtrlA|WantF2|WantReturn|While|Wrap|Xdigit|xm|xp|xs|Yes|ym|yp|ys)\b/i
|
||||
};
|
File diff suppressed because one or more lines are too long
|
@ -1,31 +0,0 @@
|
|||
Prism.languages.bash = Prism.languages.extend('clike', {
|
||||
'comment': {
|
||||
pattern: /(^|[^"{\\])#.*/,
|
||||
lookbehind: true
|
||||
},
|
||||
'string': {
|
||||
//allow multiline string
|
||||
pattern: /("|')(\\?[\s\S])*?\1/,
|
||||
inside: {
|
||||
//'property' class reused for bash variables
|
||||
'property': /\$([a-zA-Z0-9_#\?\-\*!@]+|\{[^\}]+\})/
|
||||
}
|
||||
},
|
||||
// Redefined to prevent highlighting of numbers in filenames
|
||||
'number': {
|
||||
pattern: /([^\w\.])-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/,
|
||||
lookbehind: true
|
||||
},
|
||||
// Originally based on http://ss64.com/bash/
|
||||
'function': /\b(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)\b/,
|
||||
'keyword': /\b(if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)\b/
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('bash', 'keyword', {
|
||||
//'property' class reused for bash variables
|
||||
'property': /\$([a-zA-Z0-9_#\?\-\*!@]+|\{[^}]+\})/
|
||||
});
|
||||
Prism.languages.insertBefore('bash', 'comment', {
|
||||
//shebang must be before comment, 'important' class from css reused
|
||||
'important': /^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/
|
||||
});
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.bash=Prism.languages.extend("clike",{comment:{pattern:/(^|[^"{\\])#.*/,lookbehind:!0},string:{pattern:/("|')(\\?[\s\S])*?\1/,inside:{property:/\$([a-zA-Z0-9_#\?\-\*!@]+|\{[^\}]+\})/}},number:{pattern:/([^\w\.])-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/,lookbehind:!0},"function":/\b(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)\b/,keyword:/\b(if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)\b/}),Prism.languages.insertBefore("bash","keyword",{property:/\$([a-zA-Z0-9_#\?\-\*!@]+|\{[^}]+\})/}),Prism.languages.insertBefore("bash","comment",{important:/^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/});
|
|
@ -1,20 +0,0 @@
|
|||
Prism.languages.brainfuck = {
|
||||
'pointer': {
|
||||
pattern: /<|>/,
|
||||
alias: 'keyword'
|
||||
},
|
||||
'increment': {
|
||||
pattern: /\+/,
|
||||
alias: 'inserted'
|
||||
},
|
||||
'decrement': {
|
||||
pattern: /-/,
|
||||
alias: 'deleted'
|
||||
},
|
||||
'branching': {
|
||||
pattern: /\[|\]/,
|
||||
alias: 'important'
|
||||
},
|
||||
'operator': /[.,]/,
|
||||
'comment': /\S+/
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.brainfuck={pointer:{pattern:/<|>/,alias:"keyword"},increment:{pattern:/\+/,alias:"inserted"},decrement:{pattern:/-/,alias:"deleted"},branching:{pattern:/\[|\]/,alias:"important"},operator:/[.,]/,comment:/\S+/};
|
|
@ -1,24 +0,0 @@
|
|||
Prism.languages.c = Prism.languages.extend('clike', {
|
||||
'keyword': /\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,
|
||||
'operator': /\-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*\/]/
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('c', 'string', {
|
||||
'macro': {
|
||||
// allow for multiline macro definitions
|
||||
// spaces after the # character compile fine with gcc
|
||||
pattern: /(^\s*)#\s*[a-z]+([^\r\n\\]|\\.|\\(?:\r\n?|\n))*/im,
|
||||
lookbehind: true,
|
||||
alias: 'property',
|
||||
inside: {
|
||||
// highlight the path of the include statement as a string
|
||||
'string': {
|
||||
pattern: /(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/,
|
||||
lookbehind: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
delete Prism.languages.c['class-name'];
|
||||
delete Prism.languages.c['boolean'];
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.c=Prism.languages.extend("clike",{keyword:/\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,operator:/\-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*\/]/}),Prism.languages.insertBefore("c","string",{macro:{pattern:/(^\s*)#\s*[a-z]+([^\r\n\\]|\\.|\\(?:\r\n?|\n))*/im,lookbehind:!0,alias:"property",inside:{string:{pattern:/(#\s*include\s*)(<.+?>|("|')(\\?.)+?\3)/,lookbehind:!0}}}}),delete Prism.languages.c["class-name"],delete Prism.languages.c["boolean"];
|
|
@ -1,26 +0,0 @@
|
|||
Prism.languages.clike = {
|
||||
'comment': [
|
||||
{
|
||||
pattern: /(^|[^\\])\/\*[\w\W]*?\*\//,
|
||||
lookbehind: true
|
||||
},
|
||||
{
|
||||
pattern: /(^|[^\\:])\/\/.*/,
|
||||
lookbehind: true
|
||||
}
|
||||
],
|
||||
'string': /("|')(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
|
||||
'class-name': {
|
||||
pattern: /((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
punctuation: /(\.|\\)/
|
||||
}
|
||||
},
|
||||
'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
|
||||
'boolean': /\b(true|false)\b/,
|
||||
'function': /[a-z0-9_]+(?=\()/i,
|
||||
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/,
|
||||
'operator': /[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|~|\^|%/,
|
||||
'punctuation': /[{}[\];(),.:]/
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:/("|')(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/,operator:/[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/};
|
|
@ -1,83 +0,0 @@
|
|||
(function(Prism) {
|
||||
|
||||
// Ignore comments starting with { to privilege string interpolation highlighting
|
||||
var comment = /#(?!\{).+/,
|
||||
interpolation = {
|
||||
pattern: /#\{[^}]+\}/,
|
||||
alias: 'variable'
|
||||
};
|
||||
|
||||
Prism.languages.coffeescript = Prism.languages.extend('javascript', {
|
||||
'comment': comment,
|
||||
'string': [
|
||||
|
||||
// Strings are multiline
|
||||
/'(?:\\?[^\\])*?'/,
|
||||
|
||||
{
|
||||
// Strings are multiline
|
||||
pattern: /"(?:\\?[^\\])*?"/,
|
||||
inside: {
|
||||
'interpolation': interpolation
|
||||
}
|
||||
}
|
||||
],
|
||||
'keyword': /\b(and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,
|
||||
'class-member': {
|
||||
pattern: /@(?!\d)\w+/,
|
||||
alias: 'variable'
|
||||
}
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('coffeescript', 'comment', {
|
||||
'multiline-comment': {
|
||||
pattern: /###[\s\S]+?###/,
|
||||
alias: 'comment'
|
||||
},
|
||||
|
||||
// Block regexp can contain comments and interpolation
|
||||
'block-regex': {
|
||||
pattern: /\/{3}[\s\S]*?\/{3}/,
|
||||
alias: 'regex',
|
||||
inside: {
|
||||
'comment': comment,
|
||||
'interpolation': interpolation
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('coffeescript', 'string', {
|
||||
'inline-javascript': {
|
||||
pattern: /`(?:\\?[\s\S])*?`/,
|
||||
inside: {
|
||||
'delimiter': {
|
||||
pattern: /^`|`$/,
|
||||
alias: 'punctuation'
|
||||
},
|
||||
rest: Prism.languages.javascript
|
||||
}
|
||||
},
|
||||
|
||||
// Block strings
|
||||
'multiline-string': [
|
||||
{
|
||||
pattern: /'''[\s\S]*?'''/,
|
||||
alias: 'string'
|
||||
},
|
||||
{
|
||||
pattern: /"""[\s\S]*?"""/,
|
||||
alias: 'string',
|
||||
inside: {
|
||||
interpolation: interpolation
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('coffeescript', 'keyword', {
|
||||
// Object property
|
||||
'property': /(?!\d)\w+(?=\s*:(?!:))/
|
||||
});
|
||||
|
||||
}(Prism));
|
|
@ -1 +0,0 @@
|
|||
!function(e){var n=/#(?!\{).+/,t={pattern:/#\{[^}]+\}/,alias:"variable"};e.languages.coffeescript=e.languages.extend("javascript",{comment:n,string:[/'(?:\\?[^\\])*?'/,{pattern:/"(?:\\?[^\\])*?"/,inside:{interpolation:t}}],keyword:/\b(and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),e.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:n,interpolation:t}}}),e.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\?[\s\S])*?`/,inside:{delimiter:{pattern:/^`|`$/,alias:"punctuation"},rest:e.languages.javascript}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,alias:"string"},{pattern:/"""[\s\S]*?"""/,alias:"string",inside:{interpolation:t}}]}),e.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/})}(Prism);
|
|
@ -1,427 +0,0 @@
|
|||
var _self = (typeof window !== 'undefined')
|
||||
? window // if in browser
|
||||
: (
|
||||
(typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
|
||||
? self // if in worker
|
||||
: {} // if in node js
|
||||
);
|
||||
|
||||
/**
|
||||
* Prism: Lightweight, robust, elegant syntax highlighting
|
||||
* MIT license http://www.opensource.org/licenses/mit-license.php/
|
||||
* @author Lea Verou http://lea.verou.me
|
||||
*/
|
||||
|
||||
var Prism = (function(){
|
||||
|
||||
// Private helper vars
|
||||
var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i;
|
||||
|
||||
var _ = _self.Prism = {
|
||||
util: {
|
||||
encode: function (tokens) {
|
||||
if (tokens instanceof Token) {
|
||||
return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);
|
||||
} else if (_.util.type(tokens) === 'Array') {
|
||||
return tokens.map(_.util.encode);
|
||||
} else {
|
||||
return tokens.replace(/&/g, '&').replace(/</g, '<').replace(/\u00a0/g, ' ');
|
||||
}
|
||||
},
|
||||
|
||||
type: function (o) {
|
||||
return Object.prototype.toString.call(o).match(/\[object (\w+)\]/)[1];
|
||||
},
|
||||
|
||||
// Deep clone a language definition (e.g. to extend it)
|
||||
clone: function (o) {
|
||||
var type = _.util.type(o);
|
||||
|
||||
switch (type) {
|
||||
case 'Object':
|
||||
var clone = {};
|
||||
|
||||
for (var key in o) {
|
||||
if (o.hasOwnProperty(key)) {
|
||||
clone[key] = _.util.clone(o[key]);
|
||||
}
|
||||
}
|
||||
|
||||
return clone;
|
||||
|
||||
case 'Array':
|
||||
// Check for existence for IE8
|
||||
return o.map && o.map(function(v) { return _.util.clone(v); });
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
},
|
||||
|
||||
languages: {
|
||||
extend: function (id, redef) {
|
||||
var lang = _.util.clone(_.languages[id]);
|
||||
|
||||
for (var key in redef) {
|
||||
lang[key] = redef[key];
|
||||
}
|
||||
|
||||
return lang;
|
||||
},
|
||||
|
||||
/**
|
||||
* Insert a token before another token in a language literal
|
||||
* As this needs to recreate the object (we cannot actually insert before keys in object literals),
|
||||
* we cannot just provide an object, we need anobject and a key.
|
||||
* @param inside The key (or language id) of the parent
|
||||
* @param before The key to insert before. If not provided, the function appends instead.
|
||||
* @param insert Object with the key/value pairs to insert
|
||||
* @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted.
|
||||
*/
|
||||
insertBefore: function (inside, before, insert, root) {
|
||||
root = root || _.languages;
|
||||
var grammar = root[inside];
|
||||
|
||||
if (arguments.length == 2) {
|
||||
insert = arguments[1];
|
||||
|
||||
for (var newToken in insert) {
|
||||
if (insert.hasOwnProperty(newToken)) {
|
||||
grammar[newToken] = insert[newToken];
|
||||
}
|
||||
}
|
||||
|
||||
return grammar;
|
||||
}
|
||||
|
||||
var ret = {};
|
||||
|
||||
for (var token in grammar) {
|
||||
|
||||
if (grammar.hasOwnProperty(token)) {
|
||||
|
||||
if (token == before) {
|
||||
|
||||
for (var newToken in insert) {
|
||||
|
||||
if (insert.hasOwnProperty(newToken)) {
|
||||
ret[newToken] = insert[newToken];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret[token] = grammar[token];
|
||||
}
|
||||
}
|
||||
|
||||
// Update references in other language definitions
|
||||
_.languages.DFS(_.languages, function(key, value) {
|
||||
if (value === root[inside] && key != inside) {
|
||||
this[key] = ret;
|
||||
}
|
||||
});
|
||||
|
||||
return root[inside] = ret;
|
||||
},
|
||||
|
||||
// Traverse a language definition with Depth First Search
|
||||
DFS: function(o, callback, type) {
|
||||
for (var i in o) {
|
||||
if (o.hasOwnProperty(i)) {
|
||||
callback.call(o, i, o[i], type || i);
|
||||
|
||||
if (_.util.type(o[i]) === 'Object') {
|
||||
_.languages.DFS(o[i], callback);
|
||||
}
|
||||
else if (_.util.type(o[i]) === 'Array') {
|
||||
_.languages.DFS(o[i], callback, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
highlightAll: function(async, callback) {
|
||||
var elements = document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');
|
||||
|
||||
for (var i=0, element; element = elements[i++];) {
|
||||
_.highlightElement(element, async === true, callback);
|
||||
}
|
||||
},
|
||||
|
||||
highlightElement: function(element, async, callback) {
|
||||
// Find language
|
||||
var language, grammar, parent = element;
|
||||
|
||||
while (parent && !lang.test(parent.className)) {
|
||||
parent = parent.parentNode;
|
||||
}
|
||||
|
||||
if (parent) {
|
||||
language = (parent.className.match(lang) || [,''])[1];
|
||||
grammar = _.languages[language];
|
||||
}
|
||||
|
||||
// Set language on the element, if not present
|
||||
element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
|
||||
|
||||
// Set language on the parent, for styling
|
||||
parent = element.parentNode;
|
||||
|
||||
if (/pre/i.test(parent.nodeName)) {
|
||||
parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
|
||||
}
|
||||
|
||||
if (!grammar) {
|
||||
return;
|
||||
}
|
||||
|
||||
var code = element.textContent;
|
||||
|
||||
if(!code) {
|
||||
return;
|
||||
}
|
||||
|
||||
code = code.replace(/^(?:\r?\n|\r)/,'');
|
||||
|
||||
var env = {
|
||||
element: element,
|
||||
language: language,
|
||||
grammar: grammar,
|
||||
code: code
|
||||
};
|
||||
|
||||
_.hooks.run('before-highlight', env);
|
||||
|
||||
if (async && _self.Worker) {
|
||||
var worker = new Worker(_.filename);
|
||||
|
||||
worker.onmessage = function(evt) {
|
||||
env.highlightedCode = Token.stringify(JSON.parse(evt.data), language);
|
||||
|
||||
_.hooks.run('before-insert', env);
|
||||
|
||||
env.element.innerHTML = env.highlightedCode;
|
||||
|
||||
callback && callback.call(env.element);
|
||||
_.hooks.run('after-highlight', env);
|
||||
};
|
||||
|
||||
worker.postMessage(JSON.stringify({
|
||||
language: env.language,
|
||||
code: env.code
|
||||
}));
|
||||
}
|
||||
else {
|
||||
env.highlightedCode = _.highlight(env.code, env.grammar, env.language);
|
||||
|
||||
_.hooks.run('before-insert', env);
|
||||
|
||||
env.element.innerHTML = env.highlightedCode;
|
||||
|
||||
callback && callback.call(element);
|
||||
|
||||
_.hooks.run('after-highlight', env);
|
||||
}
|
||||
},
|
||||
|
||||
highlight: function (text, grammar, language) {
|
||||
var tokens = _.tokenize(text, grammar);
|
||||
return Token.stringify(_.util.encode(tokens), language);
|
||||
},
|
||||
|
||||
tokenize: function(text, grammar, language) {
|
||||
var Token = _.Token;
|
||||
|
||||
var strarr = [text];
|
||||
|
||||
var rest = grammar.rest;
|
||||
|
||||
if (rest) {
|
||||
for (var token in rest) {
|
||||
grammar[token] = rest[token];
|
||||
}
|
||||
|
||||
delete grammar.rest;
|
||||
}
|
||||
|
||||
tokenloop: for (var token in grammar) {
|
||||
if(!grammar.hasOwnProperty(token) || !grammar[token]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var patterns = grammar[token];
|
||||
patterns = (_.util.type(patterns) === "Array") ? patterns : [patterns];
|
||||
|
||||
for (var j = 0; j < patterns.length; ++j) {
|
||||
var pattern = patterns[j],
|
||||
inside = pattern.inside,
|
||||
lookbehind = !!pattern.lookbehind,
|
||||
lookbehindLength = 0,
|
||||
alias = pattern.alias;
|
||||
|
||||
pattern = pattern.pattern || pattern;
|
||||
|
||||
for (var i=0; i<strarr.length; i++) { // Don’t cache length as it changes during the loop
|
||||
|
||||
var str = strarr[i];
|
||||
|
||||
if (strarr.length > text.length) {
|
||||
// Something went terribly wrong, ABORT, ABORT!
|
||||
break tokenloop;
|
||||
}
|
||||
|
||||
if (str instanceof Token) {
|
||||
continue;
|
||||
}
|
||||
|
||||
pattern.lastIndex = 0;
|
||||
|
||||
var match = pattern.exec(str);
|
||||
|
||||
if (match) {
|
||||
if(lookbehind) {
|
||||
lookbehindLength = match[1].length;
|
||||
}
|
||||
|
||||
var from = match.index - 1 + lookbehindLength,
|
||||
match = match[0].slice(lookbehindLength),
|
||||
len = match.length,
|
||||
to = from + len,
|
||||
before = str.slice(0, from + 1),
|
||||
after = str.slice(to + 1);
|
||||
|
||||
var args = [i, 1];
|
||||
|
||||
if (before) {
|
||||
args.push(before);
|
||||
}
|
||||
|
||||
var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias);
|
||||
|
||||
args.push(wrapped);
|
||||
|
||||
if (after) {
|
||||
args.push(after);
|
||||
}
|
||||
|
||||
Array.prototype.splice.apply(strarr, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return strarr;
|
||||
},
|
||||
|
||||
hooks: {
|
||||
all: {},
|
||||
|
||||
add: function (name, callback) {
|
||||
var hooks = _.hooks.all;
|
||||
|
||||
hooks[name] = hooks[name] || [];
|
||||
|
||||
hooks[name].push(callback);
|
||||
},
|
||||
|
||||
run: function (name, env) {
|
||||
var callbacks = _.hooks.all[name];
|
||||
|
||||
if (!callbacks || !callbacks.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i=0, callback; callback = callbacks[i++];) {
|
||||
callback(env);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var Token = _.Token = function(type, content, alias) {
|
||||
this.type = type;
|
||||
this.content = content;
|
||||
this.alias = alias;
|
||||
};
|
||||
|
||||
Token.stringify = function(o, language, parent) {
|
||||
if (typeof o == 'string') {
|
||||
return o;
|
||||
}
|
||||
|
||||
if (_.util.type(o) === 'Array') {
|
||||
return o.map(function(element) {
|
||||
return Token.stringify(element, language, o);
|
||||
}).join('');
|
||||
}
|
||||
|
||||
var env = {
|
||||
type: o.type,
|
||||
content: Token.stringify(o.content, language, parent),
|
||||
tag: 'span',
|
||||
classes: ['token', o.type],
|
||||
attributes: {},
|
||||
language: language,
|
||||
parent: parent
|
||||
};
|
||||
|
||||
if (env.type == 'comment') {
|
||||
env.attributes['spellcheck'] = 'true';
|
||||
}
|
||||
|
||||
if (o.alias) {
|
||||
var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias];
|
||||
Array.prototype.push.apply(env.classes, aliases);
|
||||
}
|
||||
|
||||
_.hooks.run('wrap', env);
|
||||
|
||||
var attributes = '';
|
||||
|
||||
for (var name in env.attributes) {
|
||||
attributes += name + '="' + (env.attributes[name] || '') + '"';
|
||||
}
|
||||
|
||||
return '<' + env.tag + ' class="' + env.classes.join(' ') + '" ' + attributes + '>' + env.content + '</' + env.tag + '>';
|
||||
|
||||
};
|
||||
|
||||
if (!_self.document) {
|
||||
if (!_self.addEventListener) {
|
||||
// in Node.js
|
||||
return _self.Prism;
|
||||
}
|
||||
// In worker
|
||||
_self.addEventListener('message', function(evt) {
|
||||
var message = JSON.parse(evt.data),
|
||||
lang = message.language,
|
||||
code = message.code;
|
||||
|
||||
_self.postMessage(JSON.stringify(_.util.encode(_.tokenize(code, _.languages[lang]))));
|
||||
_self.close();
|
||||
}, false);
|
||||
|
||||
return _self.Prism;
|
||||
}
|
||||
|
||||
// Get current script and highlight
|
||||
var script = document.getElementsByTagName('script');
|
||||
|
||||
script = script[script.length - 1];
|
||||
|
||||
if (script) {
|
||||
_.filename = script.src;
|
||||
|
||||
if (document.addEventListener && !script.hasAttribute('data-manual')) {
|
||||
document.addEventListener('DOMContentLoaded', _.highlightAll);
|
||||
}
|
||||
}
|
||||
|
||||
return _self.Prism;
|
||||
|
||||
})();
|
||||
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = Prism;
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=_self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content),e.alias):"Array"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var a={};for(var r in e)e.hasOwnProperty(r)&&(a[r]=t.util.clone(e[r]));return a;case"Array":return e.map&&e.map(function(e){return t.util.clone(e)})}return e}},languages:{extend:function(e,n){var a=t.util.clone(t.languages[e]);for(var r in n)a[r]=n[r];return a},insertBefore:function(e,n,a,r){r=r||t.languages;var i=r[e];if(2==arguments.length){a=arguments[1];for(var l in a)a.hasOwnProperty(l)&&(i[l]=a[l]);return i}var s={};for(var o in i)if(i.hasOwnProperty(o)){if(o==n)for(var l in a)a.hasOwnProperty(l)&&(s[l]=a[l]);s[o]=i[o]}return t.languages.DFS(t.languages,function(t,n){n===r[e]&&t!=e&&(this[t]=s)}),r[e]=s},DFS:function(e,n,a){for(var r in e)e.hasOwnProperty(r)&&(n.call(e,r,e[r],a||r),"Object"===t.util.type(e[r])?t.languages.DFS(e[r],n):"Array"===t.util.type(e[r])&&t.languages.DFS(e[r],n,r))}},highlightAll:function(e,n){for(var a,r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'),i=0;a=r[i++];)t.highlightElement(a,e===!0,n)},highlightElement:function(a,r,i){for(var l,s,o=a;o&&!e.test(o.className);)o=o.parentNode;if(o&&(l=(o.className.match(e)||[,""])[1],s=t.languages[l]),a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+l,o=a.parentNode,/pre/i.test(o.nodeName)&&(o.className=o.className.replace(e,"").replace(/\s+/g," ")+" language-"+l),s){var u=a.textContent;if(u){u=u.replace(/^(?:\r?\n|\r)/,"");var g={element:a,language:l,grammar:s,code:u};if(t.hooks.run("before-highlight",g),r&&_self.Worker){var c=new Worker(t.filename);c.onmessage=function(e){g.highlightedCode=n.stringify(JSON.parse(e.data),l),t.hooks.run("before-insert",g),g.element.innerHTML=g.highlightedCode,i&&i.call(g.element),t.hooks.run("after-highlight",g)},c.postMessage(JSON.stringify({language:g.language,code:g.code}))}else g.highlightedCode=t.highlight(g.code,g.grammar,g.language),t.hooks.run("before-insert",g),g.element.innerHTML=g.highlightedCode,i&&i.call(a),t.hooks.run("after-highlight",g)}}},highlight:function(e,a,r){var i=t.tokenize(e,a);return n.stringify(t.util.encode(i),r)},tokenize:function(e,n){var a=t.Token,r=[e],i=n.rest;if(i){for(var l in i)n[l]=i[l];delete n.rest}e:for(var l in n)if(n.hasOwnProperty(l)&&n[l]){var s=n[l];s="Array"===t.util.type(s)?s:[s];for(var o=0;o<s.length;++o){var u=s[o],g=u.inside,c=!!u.lookbehind,f=0,h=u.alias;u=u.pattern||u;for(var p=0;p<r.length;p++){var d=r[p];if(r.length>e.length)break e;if(!(d instanceof a)){u.lastIndex=0;var m=u.exec(d);if(m){c&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,k=y+v,b=d.slice(0,y+1),w=d.slice(k+1),N=[p,1];b&&N.push(b);var O=new a(l,g?t.tokenize(m,g):m,h);N.push(O),w&&N.push(w),Array.prototype.splice.apply(r,N)}}}}}return r},hooks:{all:{},add:function(e,n){var a=t.hooks.all;a[e]=a[e]||[],a[e].push(n)},run:function(e,n){var a=t.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(n)}}},n=t.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(n.stringify=function(e,a,r){if("string"==typeof e)return e;if("Array"===t.util.type(e))return e.map(function(t){return n.stringify(t,a,e)}).join("");var i={type:e.type,content:n.stringify(e.content,a,r),tag:"span",classes:["token",e.type],attributes:{},language:a,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}t.hooks.run("wrap",i);var s="";for(var o in i.attributes)s+=o+'="'+(i.attributes[o]||"")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'" '+s+">"+i.content+"</"+i.tag+">"},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var n=JSON.parse(e.data),a=n.language,r=n.code;_self.postMessage(JSON.stringify(t.util.encode(t.tokenize(r,t.languages[a])))),_self.close()},!1),_self.Prism):_self.Prism;var a=document.getElementsByTagName("script");return a=a[a.length-1],a&&(t.filename=a.src,document.addEventListener&&!a.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism);
|
|
@ -1,12 +0,0 @@
|
|||
Prism.languages.cpp = Prism.languages.extend('c', {
|
||||
'keyword': /\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,
|
||||
'boolean': /\b(true|false)\b/,
|
||||
'operator': /[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('cpp', 'keyword', {
|
||||
'class-name': {
|
||||
pattern: /(class\s+)[a-z0-9_]+/i,
|
||||
lookbehind: true
|
||||
}
|
||||
});
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.cpp=Prism.languages.extend("c",{keyword:/\b(alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,"boolean":/\b(true|false)\b/,operator:/[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|?\||\?|\*|\/|\b(and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/}),Prism.languages.insertBefore("cpp","keyword",{"class-name":{pattern:/(class\s+)[a-z0-9_]+/i,lookbehind:!0}});
|
|
@ -1,15 +0,0 @@
|
|||
Prism.languages.csharp = Prism.languages.extend('clike', {
|
||||
'keyword': /\b(abstract|as|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|virtual|void|volatile|while|add|alias|ascending|async|await|descending|dynamic|from|get|global|group|into|join|let|orderby|partial|remove|select|set|value|var|where|yield)\b/,
|
||||
'string': [
|
||||
/@("|')(\1\1|\\\1|\\?(?!\1)[\s\S])*\1/,
|
||||
/("|')(\\?.)*?\1/
|
||||
],
|
||||
'number': /\b-?(0x[\da-f]+|\d*\.?\d+)\b/i
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('csharp', 'keyword', {
|
||||
'preprocessor': {
|
||||
pattern: /(^\s*)#.*/m,
|
||||
lookbehind: true
|
||||
}
|
||||
});
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.csharp=Prism.languages.extend("clike",{keyword:/\b(abstract|as|async|await|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|virtual|void|volatile|while|add|alias|ascending|async|await|descending|dynamic|from|get|global|group|into|join|let|orderby|partial|remove|select|set|value|var|where|yield)\b/,string:[/@("|')(\1\1|\\\1|\\?(?!\1)[\s\S])*\1/,/("|')(\\?.)*?\1/],number:/\b-?(0x[\da-f]+|\d*\.?\d+)\b/i}),Prism.languages.insertBefore("csharp","keyword",{preprocessor:{pattern:/(^\s*)#.*/m,lookbehind:!0}});
|
|
@ -1,15 +0,0 @@
|
|||
Prism.languages.css.selector = {
|
||||
pattern: /[^\{\}\s][^\{\}]*(?=\s*\{)/,
|
||||
inside: {
|
||||
'pseudo-element': /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,
|
||||
'pseudo-class': /:[-\w]+(?:\(.*\))?/,
|
||||
'class': /\.[-:\.\w]+/,
|
||||
'id': /#[-:\.\w]+/
|
||||
}
|
||||
};
|
||||
|
||||
Prism.languages.insertBefore('css', 'function', {
|
||||
'hexcode': /#[\da-f]{3,6}/i,
|
||||
'entity': /\\[\da-f]{1,8}/i,
|
||||
'number': /[\d%\.]+/
|
||||
});
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.css.selector={pattern:/[^\{\}\s][^\{\}]*(?=\s*\{)/,inside:{"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+(?:\(.*\))?/,"class":/\.[-:\.\w]+/,id:/#[-:\.\w]+/}},Prism.languages.insertBefore("css","function",{hexcode:/#[\da-f]{3,6}/i,entity:/\\[\da-f]{1,8}/i,number:/[\d%\.]+/});
|
|
@ -1,53 +0,0 @@
|
|||
Prism.languages.css = {
|
||||
'comment': /\/\*[\w\W]*?\*\//,
|
||||
'atrule': {
|
||||
pattern: /@[\w-]+?.*?(;|(?=\s*\{))/i,
|
||||
inside: {
|
||||
'rule': /@[\w-]+/
|
||||
// See rest below
|
||||
}
|
||||
},
|
||||
'url': /url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,
|
||||
'selector': /[^\{\}\s][^\{\};]*?(?=\s*\{)/,
|
||||
'string': /("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,
|
||||
'property': /(\b|\B)[\w-]+(?=\s*:)/i,
|
||||
'important': /\B!important\b/i,
|
||||
'function': /[-a-z0-9]+(?=\()/i,
|
||||
'punctuation': /[(){};:]/
|
||||
};
|
||||
|
||||
Prism.languages.css['atrule'].inside.rest = Prism.util.clone(Prism.languages.css);
|
||||
|
||||
if (Prism.languages.markup) {
|
||||
Prism.languages.insertBefore('markup', 'tag', {
|
||||
'style': {
|
||||
pattern: /<style[\w\W]*?>[\w\W]*?<\/style>/i,
|
||||
inside: {
|
||||
'tag': {
|
||||
pattern: /<style[\w\W]*?>|<\/style>/i,
|
||||
inside: Prism.languages.markup.tag.inside
|
||||
},
|
||||
rest: Prism.languages.css
|
||||
},
|
||||
alias: 'language-css'
|
||||
}
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('inside', 'attr-value', {
|
||||
'style-attr': {
|
||||
pattern: /\s*style=("|').*?\1/i,
|
||||
inside: {
|
||||
'attr-name': {
|
||||
pattern: /^\s*style/i,
|
||||
inside: Prism.languages.markup.tag.inside
|
||||
},
|
||||
'punctuation': /^\s*=\s*['"]|['"]\s*$/,
|
||||
'attr-value': {
|
||||
pattern: /.+/i,
|
||||
inside: Prism.languages.css
|
||||
}
|
||||
},
|
||||
alias: 'language-css'
|
||||
}
|
||||
}, Prism.languages.markup.tag);
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/<style[\w\W]*?>[\w\W]*?<\/style>/i,inside:{tag:{pattern:/<style[\w\W]*?>|<\/style>/i,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css},alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag));
|
|
@ -1,18 +0,0 @@
|
|||
Prism.languages.dart = Prism.languages.extend('clike', {
|
||||
'string': [
|
||||
/r?("""|''')[\s\S]*?\1/,
|
||||
/r?("|')(\\?.)*?\1/
|
||||
],
|
||||
'keyword': [
|
||||
/\b(?:async|sync|yield)\*/,
|
||||
/\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|default|deferred|do|dynamic|else|enum|export|external|extends|factory|final|finally|for|get|if|implements|import|in|library|new|null|operator|part|rethrow|return|set|static|super|switch|this|throw|try|typedef|var|void|while|with|yield)\b/
|
||||
],
|
||||
'operator': /\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('dart','function',{
|
||||
'metadata': {
|
||||
pattern: /@\w+/,
|
||||
alias: 'symbol'
|
||||
}
|
||||
});
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.dart=Prism.languages.extend("clike",{string:[/r?("""|''')[\s\S]*?\1/,/r?("|')(\\?.)*?\1/],keyword:[/\b(?:async|sync|yield)\*/,/\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|default|deferred|do|dynamic|else|enum|export|external|extends|factory|final|finally|for|get|if|implements|import|in|library|new|null|operator|part|rethrow|return|set|static|super|switch|this|throw|try|typedef|var|void|while|with|yield)\b/],operator:/\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/}),Prism.languages.insertBefore("dart","function",{metadata:{pattern:/@\w+/,alias:"symbol"}});
|
|
@ -1,24 +0,0 @@
|
|||
Prism.languages.eiffel = {
|
||||
'string': [
|
||||
// Aligned-verbatim-strings
|
||||
/"([^[]*)\[[\s\S]+?\]\1"/,
|
||||
// Non-aligned-verbatim-strings
|
||||
/"([^{]*)\{[\s\S]+?\}\1"/,
|
||||
// Single-line string
|
||||
/"(?:%\s+%|%"|.)*?"/
|
||||
],
|
||||
// (comments including quoted strings not supported)
|
||||
'comment': /--.*/,
|
||||
// normal char | special char | char code
|
||||
'char': /'(?:%'|.)+?'/,
|
||||
'keyword': /\b(?:across|agent|alias|all|and|attached|as|assign|attribute|check|class|convert|create|Current|debug|deferred|detachable|do|else|elseif|end|ensure|expanded|export|external|feature|from|frozen|if|implies|inherit|inspect|invariant|like|local|loop|not|note|obsolete|old|once|or|Precursor|redefine|rename|require|rescue|Result|retry|select|separate|some|then|undefine|until|variant|Void|when|xor)\b/i,
|
||||
'boolean': /\b(?:True|False)\b/i,
|
||||
'number': [
|
||||
// hexa | octal | bin
|
||||
/\b0[xcb][\da-f](?:_*[\da-f])*\b/i,
|
||||
// Decimal
|
||||
/(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?[eE][+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/
|
||||
],
|
||||
'punctuation': /:=|<<|>>|\(\||\|\)|->|\.(?=\w)|[{}[\];(),:?]/,
|
||||
'operator': /\\\\|\|\.\.\||\.\.|\/[~\/=]?|[><]=?|[-+*^=~]/
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.eiffel={string:[/"([^[]*)\[[\s\S]+?\]\1"/,/"([^{]*)\{[\s\S]+?\}\1"/,/"(?:%\s+%|%"|.)*?"/],comment:/--.*/,"char":/'(?:%'|.)+?'/,keyword:/\b(?:across|agent|alias|all|and|attached|as|assign|attribute|check|class|convert|create|Current|debug|deferred|detachable|do|else|elseif|end|ensure|expanded|export|external|feature|from|frozen|if|implies|inherit|inspect|invariant|like|local|loop|not|note|obsolete|old|once|or|Precursor|redefine|rename|require|rescue|Result|retry|select|separate|some|then|undefine|until|variant|Void|when|xor)\b/i,"boolean":/\b(?:True|False)\b/i,number:[/\b0[xcb][\da-f](?:_*[\da-f])*\b/i,/(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?[eE][+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/],punctuation:/:=|<<|>>|\(\||\|\)|->|\.(?=\w)|[{}[\];(),:?]/,operator:/\\\\|\|\.\.\||\.\.|\/[~\/=]?|[><]=?|[-+*^=~]/};
|
|
@ -1,41 +0,0 @@
|
|||
Prism.languages.erlang = {
|
||||
'comment': /%.+/,
|
||||
'string': /"(?:\\?.)*?"/,
|
||||
'quoted-function': {
|
||||
pattern: /'(?:\\.|[^'\\])+'(?=\()/,
|
||||
alias: 'function'
|
||||
},
|
||||
'quoted-atom': {
|
||||
pattern: /'(?:\\.|[^'\\])+'/,
|
||||
alias: 'atom'
|
||||
},
|
||||
'boolean': /\b(?:true|false)\b/,
|
||||
'keyword': /\b(?:fun|when|case|of|end|if|receive|after|try|catch)\b/,
|
||||
'number': [
|
||||
/\$\\?./,
|
||||
/\d+#[a-z0-9]+/i,
|
||||
/(?:\b|-)\d*\.?\d+([Ee][+-]?\d+)?\b/
|
||||
],
|
||||
'function': /\b[a-z][\w@]*(?=\()/,
|
||||
'variable': {
|
||||
// Look-behind is used to prevent wrong highlighting of atoms containing "@"
|
||||
pattern: /(^|[^@])(?:\b|\?)[A-Z_][\w@]*/,
|
||||
lookbehind: true
|
||||
},
|
||||
'operator': [
|
||||
/[=\/<>:]=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/,
|
||||
{
|
||||
// We don't want to match <<
|
||||
pattern: /(^|[^<])<(?!<)/,
|
||||
lookbehind: true
|
||||
},
|
||||
{
|
||||
// We don't want to match >>
|
||||
pattern: /(^|[^>])>(?!>)/,
|
||||
lookbehind: true
|
||||
}
|
||||
],
|
||||
'atom': /\b[a-z][\w@]*/,
|
||||
'punctuation': /[()[\]{}:;,.#|]|<<|>>/
|
||||
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.erlang={comment:/%.+/,string:/"(?:\\?.)*?"/,"quoted-function":{pattern:/'(?:\\.|[^'\\])+'(?=\()/,alias:"function"},"quoted-atom":{pattern:/'(?:\\.|[^'\\])+'/,alias:"atom"},"boolean":/\b(?:true|false)\b/,keyword:/\b(?:fun|when|case|of|end|if|receive|after|try|catch)\b/,number:[/\$\\?./,/\d+#[a-z0-9]+/i,/(?:\b|-)\d*\.?\d+([Ee][+-]?\d+)?\b/],"function":/\b[a-z][\w@]*(?=\()/,variable:{pattern:/(^|[^@])(?:\b|\?)[A-Z_][\w@]*/,lookbehind:!0},operator:[/[=\/<>:]=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/,{pattern:/(^|[^<])<(?!<)/,lookbehind:!0},{pattern:/(^|[^>])>(?!>)/,lookbehind:!0}],atom:/\b[a-z][\w@]*/,punctuation:/[()[\]{}:;,.#|]|<<|>>/};
|
|
@ -1,37 +0,0 @@
|
|||
Prism.languages.fortran = {
|
||||
'quoted-number': {
|
||||
pattern: /[BOZ](['"])[A-F0-9]+\1/i,
|
||||
alias: 'number'
|
||||
},
|
||||
'string': {
|
||||
pattern: /(?:\w+_)?(['"])(?:\1\1|&(?:\r\n?|\n)(?:\s*!.+(?:\r\n?|\n))?|(?!\1).)*(?:\1|&)/,
|
||||
inside: {
|
||||
'comment': {
|
||||
pattern: /(&(?:\r\n?|\n)\s*)!.*/,
|
||||
lookbehind: true
|
||||
}
|
||||
}
|
||||
},
|
||||
'comment': /!.*/,
|
||||
'boolean': /\.(?:TRUE|FALSE)\.(?:_\w+)?/i,
|
||||
'number': /(?:\b|[+-])(?:\d+(?:\.\d*)?|\.\d+)(?:[ED][+-]?\d+)?(?:_\w+)?/i,
|
||||
'keyword': [
|
||||
// Types
|
||||
/\b(?:INTEGER|REAL|DOUBLE ?PRECISION|COMPLEX|CHARACTER|LOGICAL)\b/i,
|
||||
// END statements
|
||||
/\b(?:END ?)?(?:BLOCK ?DATA|DO|FILE|FORALL|FUNCTION|IF|INTERFACE|MODULE(?! PROCEDURE)|PROGRAM|SELECT|SUBROUTINE|TYPE|WHERE)\b/i,
|
||||
// Statements
|
||||
/\b(?:ALLOCATABLE|ALLOCATE|BACKSPACE|CALL|CASE|CLOSE|COMMON|CONTAINS|CONTINUE|CYCLE|DATA|DEALLOCATE|DIMENSION|DO|END|EQUIVALENCE|EXIT|EXTERNAL|FORMAT|GO ?TO|IMPLICIT(?: NONE)?|INQUIRE|INTENT|INTRINSIC|MODULE PROCEDURE|NAMELIST|NULLIFY|OPEN|OPTIONAL|PARAMETER|POINTER|PRINT|PRIVATE|PUBLIC|READ|RETURN|REWIND|SAVE|SELECT|STOP|TARGET|WHILE|WRITE)\b/i,
|
||||
// Others
|
||||
/\b(?:ASSIGNMENT|DEFAULT|ELEMENTAL|ELSE|ELSEWHERE|ELSEIF|ENTRY|IN|INCLUDE|INOUT|KIND|NULL|ONLY|OPERATOR|OUT|PURE|RECURSIVE|RESULT|SEQUENCE|STAT|THEN|USE)\b/i
|
||||
],
|
||||
'operator': [
|
||||
/\*\*|\/\/|=>|[=\/]=|[<>]=?|::|[+\-*=%]|\.(?:EQ|NE|LT|LE|GT|GE|NOT|AND|OR|EQV|NEQV)\.|\.[A-Z]+\./i,
|
||||
{
|
||||
// Use lookbehind to prevent confusion with (/ /)
|
||||
pattern: /(^|(?!\().)\/(?!\))/,
|
||||
lookbehind: true
|
||||
}
|
||||
],
|
||||
'punctuation': /\(\/|\/\)|[(),;:&]/
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.fortran={"quoted-number":{pattern:/[BOZ](['"])[A-F0-9]+\1/i,alias:"number"},string:{pattern:/(?:\w+_)?(['"])(?:\1\1|&(?:\r\n?|\n)(?:\s*!.+(?:\r\n?|\n))?|(?!\1).)*(?:\1|&)/,inside:{comment:{pattern:/(&(?:\r\n?|\n)\s*)!.*/,lookbehind:!0}}},comment:/!.*/,"boolean":/\.(?:TRUE|FALSE)\.(?:_\w+)?/i,number:/(?:\b|[+-])(?:\d+(?:\.\d*)?|\.\d+)(?:[ED][+-]?\d+)?(?:_\w+)?/i,keyword:[/\b(?:INTEGER|REAL|DOUBLE ?PRECISION|COMPLEX|CHARACTER|LOGICAL)\b/i,/\b(?:END ?)?(?:BLOCK ?DATA|DO|FILE|FORALL|FUNCTION|IF|INTERFACE|MODULE(?! PROCEDURE)|PROGRAM|SELECT|SUBROUTINE|TYPE|WHERE)\b/i,/\b(?:ALLOCATABLE|ALLOCATE|BACKSPACE|CALL|CASE|CLOSE|COMMON|CONTAINS|CONTINUE|CYCLE|DATA|DEALLOCATE|DIMENSION|DO|END|EQUIVALENCE|EXIT|EXTERNAL|FORMAT|GO ?TO|IMPLICIT(?: NONE)?|INQUIRE|INTENT|INTRINSIC|MODULE PROCEDURE|NAMELIST|NULLIFY|OPEN|OPTIONAL|PARAMETER|POINTER|PRINT|PRIVATE|PUBLIC|READ|RETURN|REWIND|SAVE|SELECT|STOP|TARGET|WHILE|WRITE)\b/i,/\b(?:ASSIGNMENT|DEFAULT|ELEMENTAL|ELSE|ELSEWHERE|ELSEIF|ENTRY|IN|INCLUDE|INOUT|KIND|NULL|ONLY|OPERATOR|OUT|PURE|RECURSIVE|RESULT|SEQUENCE|STAT|THEN|USE)\b/i],operator:[/\*\*|\/\/|=>|[=\/]=|[<>]=?|::|[+\-*=%]|\.(?:EQ|NE|LT|LE|GT|GE|NOT|AND|OR|EQV|NEQV)\.|\.[A-Z]+\./i,{pattern:/(^|(?!\().)\/(?!\))/,lookbehind:!0}],punctuation:/\(\/|\/\)|[(),;:&]/};
|
|
@ -1,21 +0,0 @@
|
|||
Prism.languages.fsharp = Prism.languages.extend('clike', {
|
||||
'comment': [
|
||||
{
|
||||
pattern: /(^|[^\\])\(\*[\w\W]*?\*\)/,
|
||||
lookbehind: true
|
||||
},
|
||||
{
|
||||
pattern: /(^|[^\\:])\/\/.*/,
|
||||
lookbehind: true
|
||||
}
|
||||
],
|
||||
'keyword': /\b(abstract|and|as|assert|base|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|global|if|in|inherit|inline|interface|internal|lazy|let|let!|match|member|module|mutable|namespace|new|not|null|of|open|or|override|private|public|rec|return|return!|select|static|struct|then|to|true|try|type|upcast|use|use!|val|void|when|while|with|yield|yield!|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|include|method|mixin|object|parallel|process|protected|pure|sealed|tailcall|trait|virtual|volatile)\b/,
|
||||
'string': /@?("""|"|')((\\|\n)?.)*?\1B?/,
|
||||
'preprocessor': /^\s*#.*/m,
|
||||
'number': [
|
||||
/\b-?0x[\da-fA-F]+(un|lf|LF)?\b/,
|
||||
/\b-?0b[01]+(y|uy)?\b/,
|
||||
/\b-?(\d+\.|\d*\.?\d+)([fFmM]|[eE][+-]?\d+)?\b/,
|
||||
/\b-?\d+(y|uy|s|us|l|u|ul|L|UL|I)?\b/
|
||||
]
|
||||
});
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.fsharp=Prism.languages.extend("clike",{comment:[{pattern:/(^|[^\\])\(\*[\w\W]*?\*\)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],keyword:/\b(abstract|and|as|assert|base|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|global|if|in|inherit|inline|interface|internal|lazy|let|let!|match|member|module|mutable|namespace|new|not|null|of|open|or|override|private|public|rec|return|return!|select|static|struct|then|to|true|try|type|upcast|use|use!|val|void|when|while|with|yield|yield!|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|include|method|mixin|object|parallel|process|protected|pure|sealed|tailcall|trait|virtual|volatile)\b/,string:/@?("""|"|')((\\|\n)?.)*?\1B?/,preprocessor:/^\s*#.*/m,number:[/\b-?0x[\da-fA-F]+(un|lf|LF)?\b/,/\b-?0b[01]+(y|uy)?\b/,/\b-?(\d+\.|\d*\.?\d+)([fFmM]|[eE][+-]?\d+)?\b/,/\b-?\d+(y|uy|s|us|l|u|ul|L|UL|I)?\b/]});
|
|
@ -1,78 +0,0 @@
|
|||
Prism.languages.gherkin = {
|
||||
'pystring': {
|
||||
pattern: /("""|''')[\s\S]+?\1/,
|
||||
alias: 'string'
|
||||
},
|
||||
'comment': {
|
||||
pattern: /((^|\n)[ \t]*)#.*/,
|
||||
lookbehind: true
|
||||
},
|
||||
'tag': {
|
||||
pattern: /((^|\n)[ \t]*)@.*/,
|
||||
lookbehind: true
|
||||
},
|
||||
'feature': {
|
||||
pattern: /((^|\n)[ \t]*)(Ability|Ahoy matey!|Arwedd|Aspekt|Besigheid Behoefte|Business Need|Caracteristica|Característica|Egenskab|Egenskap|Eiginleiki|Feature|Fīča|Fitur|Fonctionnalité|Fonksyonalite|Funcionalidade|Funcionalitat|Functionalitate|Funcţionalitate|Funcționalitate|Functionaliteit|Fungsi|Funkcia|Funkcija|Funkcionalitāte|Funkcionalnost|Funkcja|Funksie|Funktionalität|Funktionalitéit|Funzionalità|Hwaet|Hwæt|Jellemző|Karakteristik|laH|Lastnost|Mak|Mogucnost|Mogućnost|Moznosti|Možnosti|OH HAI|Omadus|Ominaisuus|Osobina|Özellik|perbogh|poQbogh malja'|Potrzeba biznesowa|Požadavek|Požiadavka|Pretty much|Qap|Qu'meH 'ut|Savybė|Tính năng|Trajto|Vermoë|Vlastnosť|Właściwość|Značilnost|Δυνατότητα|Λειτουργία|Могућност|Мөмкинлек|Особина|Свойство|Үзенчәлеклелек|Функционал|Функционалност|Функция|Функціонал|תכונה|خاصية|خصوصیت|صلاحیت|کاروبار کی ضرورت|وِیژگی|रूप लेख|ਖਾਸੀਅਤ|ਨਕਸ਼ ਨੁਹਾਰ|ਮੁਹਾਂਦਰਾ|గుణము|ಹೆಚ್ಚಳ|ความต้องการทางธุรกิจ|ความสามารถ|โครงหลัก|기능|フィーチャ|功能|機能):([^:]+\n)*/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'important': {
|
||||
pattern: /(:)[^\n]+/,
|
||||
lookbehind: true
|
||||
},
|
||||
keyword: /[^:\n]+:/
|
||||
}
|
||||
},
|
||||
'scenario': {
|
||||
pattern: /((^|\n)[ \t]*)(Abstract Scenario|Abstrakt Scenario|Achtergrond|Aer|Ær|Agtergrond|All y'all|Antecedentes|Antecedents|Atburðarás|Atburðarásir|Awww, look mate|B4|Background|Baggrund|Bakgrund|Bakgrunn|Bakgrunnur|Beispiele|Beispiller|Bối cảnh|Cefndir|Cenario|Cenário|Cenario de Fundo|Cenário de Fundo|Cenarios|Cenários|Contesto|Context|Contexte|Contexto|Conto|Contoh|Contone|Dæmi|Dasar|Dead men tell no tales|Delineacao do Cenario|Delineação do Cenário|Dis is what went down|Dữ liệu|Dyagram senaryo|Dyagram Senaryo|Egzanp|Ejemplos|Eksempler|Ekzemploj|Enghreifftiau|Esbozo do escenario|Escenari|Escenario|Esempi|Esquema de l'escenari|Esquema del escenario|Esquema do Cenario|Esquema do Cenário|Examples|EXAMPLZ|Exempel|Exemple|Exemples|Exemplos|First off|Fono|Forgatókönyv|Forgatókönyv vázlat|Fundo|Geçmiş|ghantoH|Grundlage|Hannergrond|Háttér|Heave to|Istorik|Juhtumid|Keadaan|Khung kịch bản|Khung tình huống|Kịch bản|Koncept|Konsep skenario|Kontèks|Kontekst|Kontekstas|Konteksts|Kontext|Konturo de la scenaro|Latar Belakang|lut|lut chovnatlh|lutmey|Lýsing Atburðarásar|Lýsing Dæma|Menggariskan Senario|MISHUN|MISHUN SRSLY|mo'|Náčrt Scenára|Náčrt Scénáře|Náčrt Scenáru|Oris scenarija|Örnekler|Osnova|Osnova Scenára|Osnova scénáře|Osnutek|Ozadje|Paraugs|Pavyzdžiai|Példák|Piemēri|Plan du scénario|Plan du Scénario|Plan senaryo|Plan Senaryo|Plang vum Szenario|Pozadí|Pozadie|Pozadina|Príklady|Příklady|Primer|Primeri|Primjeri|Przykłady|Raamstsenaarium|Reckon it's like|Rerefons|Scenár|Scénář|Scenarie|Scenarij|Scenarijai|Scenarijaus šablonas|Scenariji|Scenārijs|Scenārijs pēc parauga|Scenarijus|Scenario|Scénario|Scenario Amlinellol|Scenario Outline|Scenario Template|Scenariomal|Scenariomall|Scenarios|Scenariu|Scenariusz|Scenaro|Schema dello scenario|Se ðe|Se the|Se þe|Senario|Senaryo|Senaryo deskripsyon|Senaryo Deskripsyon|Senaryo taslağı|Shiver me timbers|Situācija|Situai|Situasie|Situasie Uiteensetting|Skenario|Skenario konsep|Skica|Structura scenariu|Structură scenariu|Struktura scenarija|Stsenaarium|Swa|Swa hwaer swa|Swa hwær swa|Szablon scenariusza|Szenario|Szenariogrundriss|Tapaukset|Tapaus|Tapausaihio|Taust|Tausta|Template Keadaan|Template Senario|Template Situai|The thing of it is|Tình huống|Variantai|Voorbeelde|Voorbeelden|Wharrimean is|Yo\-ho\-ho|You'll wanna|Założenia|Παραδείγματα|Περιγραφή Σεναρίου|Σενάρια|Σενάριο|Υπόβαθρο|Кереш|Контекст|Концепт|Мисаллар|Мисоллар|Основа|Передумова|Позадина|Предистория|Предыстория|Приклади|Пример|Примери|Примеры|Рамка на сценарий|Скица|Структура сценарија|Структура сценария|Структура сценарію|Сценарий|Сценарий структураси|Сценарийның төзелеше|Сценарији|Сценарио|Сценарій|Тарих|Үрнәкләр|דוגמאות|רקע|תבנית תרחיש|תרחיש|الخلفية|الگوی سناریو|امثلة|پس منظر|زمینه|سناریو|سيناريو|سيناريو مخطط|مثالیں|منظر نامے کا خاکہ|منظرنامہ|نمونه ها|उदाहरण|परिदृश्य|परिदृश्य रूपरेखा|पृष्ठभूमि|ਉਦਾਹਰਨਾਂ|ਪਟਕਥਾ|ਪਟਕਥਾ ਢਾਂਚਾ|ਪਟਕਥਾ ਰੂਪ ਰੇਖਾ|ਪਿਛੋਕੜ|ఉదాహరణలు|కథనం|నేపథ్యం|సన్నివేశం|ಉದಾಹರಣೆಗಳು|ಕಥಾಸಾರಾಂಶ|ವಿವರಣೆ|ಹಿನ್ನೆಲೆ|โครงสร้างของเหตุการณ์|ชุดของตัวอย่าง|ชุดของเหตุการณ์|แนวคิด|สรุปเหตุการณ์|เหตุการณ์|배경|시나리오|시나리오 개요|예|サンプル|シナリオ|シナリオアウトライン|シナリオテンプレ|シナリオテンプレート|テンプレ|例|例子|剧本|剧本大纲|劇本|劇本大綱|场景|场景大纲|場景|場景大綱|背景):[^:\n]*/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'important': {
|
||||
pattern: /(:)[^\n]*/,
|
||||
lookbehind: true
|
||||
},
|
||||
keyword: /[^:\n]+:/
|
||||
}
|
||||
},
|
||||
'table-body': {
|
||||
pattern: /(\n[ \t]*\|.+\|[^\n]*)+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'outline': {
|
||||
pattern: /<[^>]+?>/,
|
||||
alias: 'variable'
|
||||
},
|
||||
'td': {
|
||||
pattern: /[^|]+/,
|
||||
alias: 'string'
|
||||
},
|
||||
'punctuation': /\|/
|
||||
}
|
||||
},
|
||||
'table-head': {
|
||||
pattern: /(\n[ \t]*\|.+\|[^\n]*)/,
|
||||
inside: {
|
||||
'th': {
|
||||
pattern: /[^|]+/,
|
||||
alias: 'variable'
|
||||
},
|
||||
'punctuation': /\|/
|
||||
}
|
||||
},
|
||||
'atrule': {
|
||||
pattern: /(\n[ \t]+)('ach|'a|'ej|7|a|A také|A taktiež|A tiež|A zároveň|Aber|Ac|Adott|Akkor|Ak|Aleshores|Ale|Ali|Allora|Alors|Als|Ama|Amennyiben|Amikor|Ampak|an|AN|Ananging|And y'all|And|Angenommen|Anrhegedig a|An|Apabila|Atès|Atesa|Atunci|Avast!|Aye|A|awer|Bagi|Banjur|Bet|Biết|Blimey!|Buh|But at the end of the day I reckon|But y'all|But|BUT|Cal|Când|Cando|Cand|Ce|Cuando|Če|Ða ðe|Ða|Dadas|Dada|Dados|Dado|DaH ghu' bejlu'|dann|Dann|Dano|Dan|Dar|Dat fiind|Data|Date fiind|Date|Dati fiind|Dati|Daţi fiind|Dați fiind|Dato|DEN|Den youse gotta|Dengan|De|Diberi|Diyelim ki|Donada|Donat|Donitaĵo|Do|Dun|Duota|Ðurh|Eeldades|Ef|Eğer ki|Entao|Então|Entón|Entonces|En|Epi|E|És|Etant donnée|Etant donné|Et|Étant données|Étant donnée|Étant donné|Etant données|Etant donnés|Étant donnés|Fakat|Gangway!|Gdy|Gegeben seien|Gegeben sei|Gegeven|Gegewe|ghu' noblu'|Gitt|Given y'all|Given|Givet|Givun|Ha|Cho|I CAN HAZ|In|Ir|It's just unbelievable|I|Ja|Jeśli|Jeżeli|Kadar|Kada|Kad|Kai|Kaj|Když|Keď|Kemudian|Ketika|Khi|Kiedy|Ko|Kuid|Kui|Kun|Lan|latlh|Le sa a|Let go and haul|Le|Lè sa a|Lè|Logo|Lorsqu'<|Lorsque|mä|Maar|Mais|Mając|Majd|Maka|Manawa|Mas|Ma|Menawa|Men|Mutta|Nalikaning|Nalika|Nanging|Når|När|Nato|Nhưng|Niin|Njuk|O zaman|Og|Och|Oletetaan|Onda|Ond|Oraz|Pak|Pero|Però|Podano|Pokiaľ|Pokud|Potem|Potom|Privzeto|Pryd|qaSDI'|Quando|Quand|Quan|Så|Sed|Se|Siis|Sipoze ke|Sipoze Ke|Sipoze|Si|Şi|Și|Soit|Stel|Tada|Tad|Takrat|Tak|Tapi|Ter|Tetapi|Tha the|Tha|Then y'all|Then|Thì|Thurh|Toda|Too right|ugeholl|Und|Un|Và|vaj|Vendar|Ve|wann|Wanneer|WEN|Wenn|When y'all|When|Wtedy|Wun|Y'know|Yeah nah|Yna|Youse know like when|Youse know when youse got|Y|Za predpokladu|Za předpokladu|Zadani|Zadano|Zadan|Zadate|Zadato|Zakładając|Zaradi|Zatati|Þa|Þá|Þa þe|Þegar|Þurh|Αλλά|Δεδομένου|Και|Όταν|Τότε|А також|Агар|Але|Али|Аммо|А|Әгәр|Әйтик|Әмма|Бирок|Ва|Вә|Дадено|Дано|Допустим|Если|Задате|Задати|Задато|И|І|К тому же|Када|Кад|Когато|Когда|Коли|Ләкин|Лекин|Нәтиҗәдә|Нехай|Но|Онда|Припустимо, що|Припустимо|Пусть|Также|Та|Тогда|Тоді|То|Унда|Һәм|Якщо|אבל|אזי|אז|בהינתן|וגם|כאשר|آنگاه|اذاً|اگر|اما|اور|با فرض|بالفرض|بفرض|پھر|تب|ثم|جب|عندما|فرض کیا|لكن|لیکن|متى|هنگامی|و|अगर|और|कदा|किन्तु|चूंकि|जब|तथा|तदा|तब|परन्तु|पर|यदि|ਅਤੇ|ਜਦੋਂ|ਜਿਵੇਂ ਕਿ|ਜੇਕਰ|ਤਦ|ਪਰ|అప్పుడు|ఈ పరిస్థితిలో|కాని|చెప్పబడినది|మరియు|ಆದರೆ|ನಂತರ|ನೀಡಿದ|ಮತ್ತು|ಸ್ಥಿತಿಯನ್ನು|กำหนดให้|ดังนั้น|แต่|เมื่อ|และ|그러면<|그리고<|단<|만약<|만일<|먼저<|조건<|하지만<|かつ<|しかし<|ただし<|ならば<|もし<|並且<|但し<|但是<|假如<|假定<|假設<|假设<|前提<|同时<|同時<|并且<|当<|當<|而且<|那么<|那麼<)(?=[ \t]+)/,
|
||||
lookbehind: true
|
||||
},
|
||||
'string': {
|
||||
pattern: /("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*')/,
|
||||
inside: {
|
||||
'outline': {
|
||||
pattern: /<[^>]+?>/,
|
||||
alias: 'variable'
|
||||
}
|
||||
}
|
||||
},
|
||||
'outline': {
|
||||
pattern: /<[^>]+?>/,
|
||||
alias: 'variable'
|
||||
}
|
||||
};
|
File diff suppressed because one or more lines are too long
|
@ -1,68 +0,0 @@
|
|||
Prism.languages.git = {
|
||||
/*
|
||||
* A simple one line comment like in a git status command
|
||||
* For instance:
|
||||
* $ git status
|
||||
* # On branch infinite-scroll
|
||||
* # Your branch and 'origin/sharedBranches/frontendTeam/infinite-scroll' have diverged,
|
||||
* # and have 1 and 2 different commits each, respectively.
|
||||
* nothing to commit (working directory clean)
|
||||
*/
|
||||
'comment': /^#.*$/m,
|
||||
|
||||
/*
|
||||
* a string (double and simple quote)
|
||||
*/
|
||||
'string': /("|')(\\?.)*?\1/m,
|
||||
|
||||
/*
|
||||
* a git command. It starts with a random prompt finishing by a $, then "git" then some other parameters
|
||||
* For instance:
|
||||
* $ git add file.txt
|
||||
*/
|
||||
'command': {
|
||||
pattern: /^.*\$ git .*$/m,
|
||||
inside: {
|
||||
/*
|
||||
* A git command can contain a parameter starting by a single or a double dash followed by a string
|
||||
* For instance:
|
||||
* $ git diff --cached
|
||||
* $ git log -p
|
||||
*/
|
||||
'parameter': /\s(--|-)\w+/m
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* Coordinates displayed in a git diff command
|
||||
* For instance:
|
||||
* $ git diff
|
||||
* diff --git file.txt file.txt
|
||||
* index 6214953..1d54a52 100644
|
||||
* --- file.txt
|
||||
* +++ file.txt
|
||||
* @@ -1 +1,2 @@
|
||||
* -Here's my tetx file
|
||||
* +Here's my text file
|
||||
* +And this is the second line
|
||||
*/
|
||||
'coord': /^@@.*@@$/m,
|
||||
|
||||
/*
|
||||
* Regexp to match the changed lines in a git diff output. Check the example above.
|
||||
*/
|
||||
'deleted': /^-(?!-).+$/m,
|
||||
'inserted': /^\+(?!\+).+$/m,
|
||||
|
||||
/*
|
||||
* Match a "commit [SHA1]" line in a git log output.
|
||||
* For instance:
|
||||
* $ git log
|
||||
* commit a11a14ef7e26f2ca62d4b35eac455ce636d0dc09
|
||||
* Author: lgiraudel
|
||||
* Date: Mon Feb 17 11:18:34 2014 +0100
|
||||
*
|
||||
* Add of a new line
|
||||
*/
|
||||
'commit_sha1': /^commit \w{40}$/m
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.git={comment:/^#.*$/m,string:/("|')(\\?.)*?\1/m,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s(--|-)\w+/m}},coord:/^@@.*@@$/m,deleted:/^-(?!-).+$/m,inserted:/^\+(?!\+).+$/m,commit_sha1:/^commit \w{40}$/m};
|
|
@ -1,9 +0,0 @@
|
|||
Prism.languages.go = Prism.languages.extend('clike', {
|
||||
'keyword': /\b(break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,
|
||||
'builtin': /\b(bool|byte|complex(64|128)|error|float(32|64)|rune|string|u?int(8|16|32|64|)|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(ln)?|real|recover)\b/,
|
||||
'boolean': /\b(_|iota|nil|true|false)\b/,
|
||||
'operator': /([(){}\[\]]|[*\/%^!]=?|\+[=+]?|-[>=-]?|\|[=|]?|>[=>]?|<(<|[=-])?|==?|&(&|=|^=?)?|\.(\.\.)?|[,;]|:=?)/,
|
||||
'number': /\b(-?(0x[a-f\d]+|(\d+\.?\d*|\.\d+)(e[-+]?\d+)?)i?)\b/i,
|
||||
'string': /("|'|`)(\\?.|\r|\n)*?\1/
|
||||
});
|
||||
delete Prism.languages.go['class-name'];
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.go=Prism.languages.extend("clike",{keyword:/\b(break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,builtin:/\b(bool|byte|complex(64|128)|error|float(32|64)|rune|string|u?int(8|16|32|64|)|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(ln)?|real|recover)\b/,"boolean":/\b(_|iota|nil|true|false)\b/,operator:/([(){}\[\]]|[*\/%^!]=?|\+[=+]?|-[>=-]?|\|[=|]?|>[=>]?|<(<|[=-])?|==?|&(&|=|^=?)?|\.(\.\.)?|[,;]|:=?)/,number:/\b(-?(0x[a-f\d]+|(\d+\.?\d*|\.\d+)(e[-+]?\d+)?)i?)\b/i,string:/("|'|`)(\\?.|\r|\n)*?\1/}),delete Prism.languages.go["class-name"];
|
|
@ -1,50 +0,0 @@
|
|||
Prism.languages.groovy = Prism.languages.extend('clike', {
|
||||
'keyword': /\b(as|def|in|abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|trait|transient|try|void|volatile|while)\b/,
|
||||
'string': /("""|''')[\W\w]*?\1|("|'|\/)(?:\\?.)*?\2|(\$\/)(\$\/\$|[\W\w])*?\/\$/,
|
||||
'number': /\b0b[01_]+\b|\b0x[\da-f_]+(\.[\da-f_p\-]+)?\b|\b[\d_]+(\.[\d_]+[e]?[\d]*)?[glidf]\b|[\d_]+(\.[\d_]+)?\b/i,
|
||||
'operator': {
|
||||
pattern: /(^|[^.])(={0,2}~|\?\.|\*?\.@|\.&|\.{1,2}(?!\.)|\.{2}<?(?=\w)|->|\?:|[-+]{1,2}|!|<=>|>{1,3}|<{1,2}|={1,2}|&{1,2}|\|{1,2}|\?|\*{1,2}|\/|\^|%)/,
|
||||
lookbehind: true
|
||||
},
|
||||
'punctuation': /\.+|[{}[\];(),:$]/
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('groovy', 'string', {
|
||||
'shebang': {
|
||||
pattern: /#!.+/,
|
||||
alias: 'comment'
|
||||
}
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('groovy', 'punctuation', {
|
||||
'spock-block': /\b(setup|given|when|then|and|cleanup|expect|where):/
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('groovy', 'function', {
|
||||
'annotation': {
|
||||
pattern: /(^|[^.])@\w+/,
|
||||
lookbehind: true
|
||||
}
|
||||
});
|
||||
|
||||
Prism.hooks.add('wrap', function(env) {
|
||||
if (env.language === 'groovy' && env.type === 'string') {
|
||||
var delimiter = env.content[0];
|
||||
|
||||
if (delimiter != "'") {
|
||||
var pattern = /([^\\])(\$(\{.*?\}|[\w\.]+))/;
|
||||
if (delimiter === '$') {
|
||||
pattern = /([^\$])(\$(\{.*?\}|[\w\.]+))/;
|
||||
}
|
||||
env.content = Prism.highlight(env.content, {
|
||||
'expression': {
|
||||
pattern: pattern,
|
||||
lookbehind: true,
|
||||
inside: Prism.languages.groovy
|
||||
}
|
||||
});
|
||||
|
||||
env.classes.push(delimiter === '/' ? 'regex' : 'gstring');
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.groovy=Prism.languages.extend("clike",{keyword:/\b(as|def|in|abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|trait|transient|try|void|volatile|while)\b/,string:/("""|''')[\W\w]*?\1|("|'|\/)(?:\\?.)*?\2|(\$\/)(\$\/\$|[\W\w])*?\/\$/,number:/\b0b[01_]+\b|\b0x[\da-f_]+(\.[\da-f_p\-]+)?\b|\b[\d_]+(\.[\d_]+[e]?[\d]*)?[glidf]\b|[\d_]+(\.[\d_]+)?\b/i,operator:{pattern:/(^|[^.])(={0,2}~|\?\.|\*?\.@|\.&|\.{1,2}(?!\.)|\.{2}<?(?=\w)|->|\?:|[-+]{1,2}|!|<=>|>{1,3}|<{1,2}|={1,2}|&{1,2}|\|{1,2}|\?|\*{1,2}|\/|\^|%)/,lookbehind:!0},punctuation:/\.+|[{}[\];(),:$]/}),Prism.languages.insertBefore("groovy","string",{shebang:{pattern:/#!.+/,alias:"comment"}}),Prism.languages.insertBefore("groovy","punctuation",{"spock-block":/\b(setup|given|when|then|and|cleanup|expect|where):/}),Prism.languages.insertBefore("groovy","function",{annotation:{pattern:/(^|[^.])@\w+/,lookbehind:!0}}),Prism.hooks.add("wrap",function(e){if("groovy"===e.language&&"string"===e.type){var t=e.content[0];if("'"!=t){var n=/([^\\])(\$(\{.*?\}|[\w\.]+))/;"$"===t&&(n=/([^\$])(\$(\{.*?\}|[\w\.]+))/),e.content=Prism.highlight(e.content,{expression:{pattern:n,lookbehind:!0,inside:Prism.languages.groovy}}),e.classes.push("/"===t?"regex":"gstring")}}});
|
|
@ -1,161 +0,0 @@
|
|||
/* TODO
|
||||
Handle multiline code after tag
|
||||
%foo= some |
|
||||
multiline |
|
||||
code |
|
||||
*/
|
||||
|
||||
(function(Prism) {
|
||||
|
||||
Prism.languages.haml = {
|
||||
// Multiline stuff should appear before the rest
|
||||
|
||||
'multiline-comment': [
|
||||
{
|
||||
pattern: /((?:^|\n)([\t ]*))\/.*(\n\2[\t ]+.+)*/,
|
||||
lookbehind: true,
|
||||
alias: 'comment'
|
||||
},
|
||||
{
|
||||
pattern: /((?:^|\n)([\t ]*))-#.*(\n\2[\t ]+.+)*/,
|
||||
lookbehind: true,
|
||||
alias: 'comment'
|
||||
}
|
||||
],
|
||||
|
||||
'multiline-code': [
|
||||
{
|
||||
pattern: /((?:^|\n)([\t ]*)(?:[~-]|[&!]?=)).*,[\t ]*(\n\2[\t ]+.*,[\t ]*)*(\n\2[\t ]+.+)/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.ruby
|
||||
}
|
||||
},
|
||||
{
|
||||
pattern: /((?:^|\n)([\t ]*)(?:[~-]|[&!]?=)).*\|[\t ]*(\n\2[\t ]+.*\|[\t ]*)*/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.ruby
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
// See at the end of the file for known filters
|
||||
'filter': {
|
||||
pattern: /((?:^|\n)([\t ]*)):[\w-]+(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'filter-name': {
|
||||
pattern: /^:[\w-]+/,
|
||||
alias: 'variable'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
'markup': {
|
||||
pattern: /((?:^|\n)[\t ]*)<.+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.markup
|
||||
}
|
||||
},
|
||||
'doctype': {
|
||||
pattern: /((?:^|\n)[\t ]*)!!!(?: .+)?/,
|
||||
lookbehind: true
|
||||
},
|
||||
'tag': {
|
||||
// Allows for one nested group of braces
|
||||
pattern: /((?:^|\n)[\t ]*)[%.#][\w\-#.]*[\w\-](?:\([^)]+\)|\{(?:\{[^}]+\}|[^}])+\}|\[[^\]]+\])*[\/<>]*/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'attributes': [
|
||||
{
|
||||
// Lookbehind tries to prevent interpolations for breaking it all
|
||||
// Allows for one nested group of braces
|
||||
pattern: /(^|[^#])\{(?:\{[^}]+\}|[^}])+\}/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.ruby
|
||||
}
|
||||
},
|
||||
{
|
||||
pattern: /\([^)]+\)/,
|
||||
inside: {
|
||||
'attr-value': {
|
||||
pattern: /(=\s*)(?:"(?:\\?.)*?"|[^)\s]+)/,
|
||||
lookbehind: true
|
||||
},
|
||||
'attr-name': /[\w:-]+(?=\s*!?=|\s*[,)])/,
|
||||
'punctuation': /[=(),]/
|
||||
}
|
||||
},
|
||||
{
|
||||
pattern: /\[[^\]]+\]/,
|
||||
inside: {
|
||||
rest: Prism.languages.ruby
|
||||
}
|
||||
}
|
||||
],
|
||||
'punctuation': /[<>]/
|
||||
}
|
||||
},
|
||||
'code': {
|
||||
pattern: /((?:^|\n)[\t ]*(?:[~-]|[&!]?=)).+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.ruby
|
||||
}
|
||||
},
|
||||
// Interpolations in plain text
|
||||
'interpolation': {
|
||||
pattern: /#\{[^}]+\}/,
|
||||
inside: {
|
||||
'delimiter': {
|
||||
pattern: /^#\{|\}$/,
|
||||
alias: 'punctuation'
|
||||
},
|
||||
rest: Prism.languages.ruby
|
||||
}
|
||||
},
|
||||
'punctuation': {
|
||||
pattern: /((?:^|\n)[\t ]*)[~=\-&!]/,
|
||||
lookbehind: true
|
||||
}
|
||||
};
|
||||
|
||||
var filter_pattern = '((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+';
|
||||
|
||||
// Non exhaustive list of available filters and associated languages
|
||||
var filters = [
|
||||
'css',
|
||||
{filter:'coffee',language:'coffeescript'},
|
||||
'erb',
|
||||
'javascript',
|
||||
'less',
|
||||
'markdown',
|
||||
'ruby',
|
||||
'scss',
|
||||
'textile'
|
||||
];
|
||||
var all_filters = {};
|
||||
for (var i = 0, l = filters.length; i < l; i++) {
|
||||
var filter = filters[i];
|
||||
filter = typeof filter === 'string' ? {filter: filter, language: filter} : filter;
|
||||
if (Prism.languages[filter.language]) {
|
||||
all_filters['filter-' + filter.filter] = {
|
||||
pattern: RegExp(filter_pattern.replace('{{filter_name}}', filter.filter)),
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'filter-name': {
|
||||
pattern: /^:[\w-]+/,
|
||||
alias: 'variable'
|
||||
},
|
||||
rest: Prism.languages[filter.language]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Prism.languages.insertBefore('haml', 'filter', all_filters);
|
||||
|
||||
}(Prism));
|
|
@ -1 +0,0 @@
|
|||
!function(e){e.languages.haml={"multiline-comment":[{pattern:/((?:^|\n)([\t ]*))\/.*(\n\2[\t ]+.+)*/,lookbehind:!0,alias:"comment"},{pattern:/((?:^|\n)([\t ]*))-#.*(\n\2[\t ]+.+)*/,lookbehind:!0,alias:"comment"}],"multiline-code":[{pattern:/((?:^|\n)([\t ]*)(?:[~-]|[&!]?=)).*,[\t ]*(\n\2[\t ]+.*,[\t ]*)*(\n\2[\t ]+.+)/,lookbehind:!0,inside:{rest:e.languages.ruby}},{pattern:/((?:^|\n)([\t ]*)(?:[~-]|[&!]?=)).*\|[\t ]*(\n\2[\t ]+.*\|[\t ]*)*/,lookbehind:!0,inside:{rest:e.languages.ruby}}],filter:{pattern:/((?:^|\n)([\t ]*)):[\w-]+(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"}}},markup:{pattern:/((?:^|\n)[\t ]*)<.+/,lookbehind:!0,inside:{rest:e.languages.markup}},doctype:{pattern:/((?:^|\n)[\t ]*)!!!(?: .+)?/,lookbehind:!0},tag:{pattern:/((?:^|\n)[\t ]*)[%.#][\w\-#.]*[\w\-](?:\([^)]+\)|\{(?:\{[^}]+\}|[^}])+\}|\[[^\]]+\])*[\/<>]*/,lookbehind:!0,inside:{attributes:[{pattern:/(^|[^#])\{(?:\{[^}]+\}|[^}])+\}/,lookbehind:!0,inside:{rest:e.languages.ruby}},{pattern:/\([^)]+\)/,inside:{"attr-value":{pattern:/(=\s*)(?:"(?:\\?.)*?"|[^)\s]+)/,lookbehind:!0},"attr-name":/[\w:-]+(?=\s*!?=|\s*[,)])/,punctuation:/[=(),]/}},{pattern:/\[[^\]]+\]/,inside:{rest:e.languages.ruby}}],punctuation:/[<>]/}},code:{pattern:/((?:^|\n)[\t ]*(?:[~-]|[&!]?=)).+/,lookbehind:!0,inside:{rest:e.languages.ruby}},interpolation:{pattern:/#\{[^}]+\}/,inside:{delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"},rest:e.languages.ruby}},punctuation:{pattern:/((?:^|\n)[\t ]*)[~=\-&!]/,lookbehind:!0}};for(var t="((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+",n=["css",{filter:"coffee",language:"coffeescript"},"erb","javascript","less","markdown","ruby","scss","textile"],a={},i=0,r=n.length;r>i;i++){var l=n[i];l="string"==typeof l?{filter:l,language:l}:l,e.languages[l.language]&&(a["filter-"+l.filter]={pattern:RegExp(t.replace("{{filter_name}}",l.filter)),lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"},rest:e.languages[l.language]}})}e.languages.insertBefore("haml","filter",a)}(Prism);
|
|
@ -1,82 +0,0 @@
|
|||
(function(Prism) {
|
||||
|
||||
var handlebars_pattern = /\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g;
|
||||
|
||||
Prism.languages.handlebars = Prism.languages.extend('markup', {
|
||||
'handlebars': {
|
||||
pattern: handlebars_pattern,
|
||||
inside: {
|
||||
'delimiter': {
|
||||
pattern: /^\{\{\{?|\}\}\}?$/i,
|
||||
alias: 'punctuation'
|
||||
},
|
||||
'string': /(["'])(\\?.)+?\1/,
|
||||
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/,
|
||||
'boolean': /\b(true|false)\b/,
|
||||
'block': {
|
||||
pattern: /^(\s*~?\s*)[#\/]\S+/i,
|
||||
lookbehind: true,
|
||||
alias: 'keyword'
|
||||
},
|
||||
'brackets': {
|
||||
pattern: /\[[^\]]+\]/,
|
||||
inside: {
|
||||
punctuation: /\[|\]/,
|
||||
variable: /[\w\W]+/
|
||||
}
|
||||
},
|
||||
'punctuation': /[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/,
|
||||
'variable': /[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Comments are inserted at top so that they can
|
||||
// surround markup
|
||||
Prism.languages.insertBefore('handlebars', 'tag', {
|
||||
'handlebars-comment': {
|
||||
pattern: /\{\{![\w\W]*?\}\}/,
|
||||
alias: ['handlebars','comment']
|
||||
}
|
||||
});
|
||||
|
||||
// Tokenize all inline Handlebars expressions that are wrapped in {{ }} or {{{ }}}
|
||||
// This allows for easy Handlebars + markup highlighting
|
||||
Prism.hooks.add('before-highlight', function(env) {
|
||||
if (env.language !== 'handlebars') {
|
||||
return;
|
||||
}
|
||||
|
||||
env.tokenStack = [];
|
||||
|
||||
env.backupCode = env.code;
|
||||
env.code = env.code.replace(handlebars_pattern, function(match) {
|
||||
env.tokenStack.push(match);
|
||||
|
||||
return '___HANDLEBARS' + env.tokenStack.length + '___';
|
||||
});
|
||||
});
|
||||
|
||||
// Restore env.code for other plugins (e.g. line-numbers)
|
||||
Prism.hooks.add('before-insert', function(env) {
|
||||
if (env.language === 'handlebars') {
|
||||
env.code = env.backupCode;
|
||||
delete env.backupCode;
|
||||
}
|
||||
});
|
||||
|
||||
// Re-insert the tokens after highlighting
|
||||
// and highlight them with defined grammar
|
||||
Prism.hooks.add('after-highlight', function(env) {
|
||||
if (env.language !== 'handlebars') {
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0, t; t = env.tokenStack[i]; i++) {
|
||||
env.highlightedCode = env.highlightedCode.replace('___HANDLEBARS' + (i + 1) + '___', Prism.highlight(t, env.grammar, 'handlebars'));
|
||||
}
|
||||
|
||||
env.element.innerHTML = env.highlightedCode;
|
||||
});
|
||||
|
||||
}(Prism));
|
|
@ -1 +0,0 @@
|
|||
!function(e){var a=/\{\{\{[\w\W]+?\}\}\}|\{\{[\w\W]+?\}\}/g;e.languages.handlebars=e.languages.extend("markup",{handlebars:{pattern:a,inside:{delimiter:{pattern:/^\{\{\{?|\}\}\}?$/i,alias:"punctuation"},string:/(["'])(\\?.)+?\1/,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/,"boolean":/\b(true|false)\b/,block:{pattern:/^(\s*~?\s*)[#\/]\S+/i,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/,variable:/[\w\W]+/}},punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]+/}}}),e.languages.insertBefore("handlebars","tag",{"handlebars-comment":{pattern:/\{\{![\w\W]*?\}\}/,alias:["handlebars","comment"]}}),e.hooks.add("before-highlight",function(e){"handlebars"===e.language&&(e.tokenStack=[],e.backupCode=e.code,e.code=e.code.replace(a,function(a){return e.tokenStack.push(a),"___HANDLEBARS"+e.tokenStack.length+"___"}))}),e.hooks.add("before-insert",function(e){"handlebars"===e.language&&(e.code=e.backupCode,delete e.backupCode)}),e.hooks.add("after-highlight",function(a){if("handlebars"===a.language){for(var n,t=0;n=a.tokenStack[t];t++)a.highlightedCode=a.highlightedCode.replace("___HANDLEBARS"+(t+1)+"___",e.highlight(n,a.grammar,"handlebars"));a.element.innerHTML=a.highlightedCode}})}(Prism);
|
|
@ -1,32 +0,0 @@
|
|||
Prism.languages.haskell= {
|
||||
'comment': {
|
||||
pattern: /(^|[^-!#$%*+=\?&@|~.:<>^\\])(--[^-!#$%*+=\?&@|~.:<>^\\].*(\r?\n|$)|{-[\w\W]*?-})/m,
|
||||
lookbehind: true
|
||||
},
|
||||
'char': /'([^\\"]|\\([abfnrtv\\"'&]|\^[A-Z@[\]\^_]|NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|\d+|o[0-7]+|x[0-9a-fA-F]+))'/,
|
||||
'string': /"([^\\"]|\\([abfnrtv\\"'&]|\^[A-Z@[\]\^_]|NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|\d+|o[0-7]+|x[0-9a-fA-F]+)|\\\s+\\)*"/,
|
||||
'keyword' : /\b(case|class|data|deriving|do|else|if|in|infixl|infixr|instance|let|module|newtype|of|primitive|then|type|where)\b/,
|
||||
'import_statement' : {
|
||||
// The imported or hidden names are not included in this import
|
||||
// statement. This is because we want to highlight those exactly like
|
||||
// we do for the names in the program.
|
||||
pattern: /(\n|^)\s*(import)\s+(qualified\s+)?(([A-Z][_a-zA-Z0-9']*)(\.[A-Z][_a-zA-Z0-9']*)*)(\s+(as)\s+(([A-Z][_a-zA-Z0-9']*)(\.[A-Z][_a-zA-Z0-9']*)*))?(\s+hiding\b)?/m,
|
||||
inside: {
|
||||
'keyword': /\b(import|qualified|as|hiding)\b/
|
||||
}
|
||||
},
|
||||
// These are builtin variables only. Constructors are highlighted later as a constant.
|
||||
'builtin': /\b(abs|acos|acosh|all|and|any|appendFile|approxRational|asTypeOf|asin|asinh|atan|atan2|atanh|basicIORun|break|catch|ceiling|chr|compare|concat|concatMap|const|cos|cosh|curry|cycle|decodeFloat|denominator|digitToInt|div|divMod|drop|dropWhile|either|elem|encodeFloat|enumFrom|enumFromThen|enumFromThenTo|enumFromTo|error|even|exp|exponent|fail|filter|flip|floatDigits|floatRadix|floatRange|floor|fmap|foldl|foldl1|foldr|foldr1|fromDouble|fromEnum|fromInt|fromInteger|fromIntegral|fromRational|fst|gcd|getChar|getContents|getLine|group|head|id|inRange|index|init|intToDigit|interact|ioError|isAlpha|isAlphaNum|isAscii|isControl|isDenormalized|isDigit|isHexDigit|isIEEE|isInfinite|isLower|isNaN|isNegativeZero|isOctDigit|isPrint|isSpace|isUpper|iterate|last|lcm|length|lex|lexDigits|lexLitChar|lines|log|logBase|lookup|map|mapM|mapM_|max|maxBound|maximum|maybe|min|minBound|minimum|mod|negate|not|notElem|null|numerator|odd|or|ord|otherwise|pack|pi|pred|primExitWith|print|product|properFraction|putChar|putStr|putStrLn|quot|quotRem|range|rangeSize|read|readDec|readFile|readFloat|readHex|readIO|readInt|readList|readLitChar|readLn|readOct|readParen|readSigned|reads|readsPrec|realToFrac|recip|rem|repeat|replicate|return|reverse|round|scaleFloat|scanl|scanl1|scanr|scanr1|seq|sequence|sequence_|show|showChar|showInt|showList|showLitChar|showParen|showSigned|showString|shows|showsPrec|significand|signum|sin|sinh|snd|sort|span|splitAt|sqrt|subtract|succ|sum|tail|take|takeWhile|tan|tanh|threadToIOResult|toEnum|toInt|toInteger|toLower|toRational|toUpper|truncate|uncurry|undefined|unlines|until|unwords|unzip|unzip3|userError|words|writeFile|zip|zip3|zipWith|zipWith3)\b/,
|
||||
// decimal integers and floating point numbers | octal integers | hexadecimal integers
|
||||
'number' : /\b(\d+(\.\d+)?([eE][+-]?\d+)?|0[Oo][0-7]+|0[Xx][0-9a-fA-F]+)\b/,
|
||||
// Most of this is needed because of the meaning of a single '.'.
|
||||
// If it stands alone freely, it is the function composition.
|
||||
// It may also be a separator between a module name and an identifier => no
|
||||
// operator. If it comes together with other special characters it is an
|
||||
// operator too.
|
||||
'operator' : /\s\.\s|([-!#$%*+=\?&@|~:<>^\\]*\.[-!#$%*+=\?&@|~:<>^\\]+)|([-!#$%*+=\?&@|~:<>^\\]+\.[-!#$%*+=\?&@|~:<>^\\]*)|[-!#$%*+=\?&@|~:<>^\\]+|(`([A-Z][_a-zA-Z0-9']*\.)*[_a-z][_a-zA-Z0-9']*`)/,
|
||||
// In Haskell, nearly everything is a variable, do not highlight these.
|
||||
'hvariable': /\b([A-Z][_a-zA-Z0-9']*\.)*[_a-z][_a-zA-Z0-9']*\b/,
|
||||
'constant': /\b([A-Z][_a-zA-Z0-9']*\.)*[A-Z][_a-zA-Z0-9']*\b/,
|
||||
'punctuation' : /[{}[\];(),.:]/
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.haskell={comment:{pattern:/(^|[^-!#$%*+=\?&@|~.:<>^\\])(--[^-!#$%*+=\?&@|~.:<>^\\].*(\r?\n|$)|{-[\w\W]*?-})/m,lookbehind:!0},"char":/'([^\\"]|\\([abfnrtv\\"'&]|\^[A-Z@[\]\^_]|NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|\d+|o[0-7]+|x[0-9a-fA-F]+))'/,string:/"([^\\"]|\\([abfnrtv\\"'&]|\^[A-Z@[\]\^_]|NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|\d+|o[0-7]+|x[0-9a-fA-F]+)|\\\s+\\)*"/,keyword:/\b(case|class|data|deriving|do|else|if|in|infixl|infixr|instance|let|module|newtype|of|primitive|then|type|where)\b/,import_statement:{pattern:/(\n|^)\s*(import)\s+(qualified\s+)?(([A-Z][_a-zA-Z0-9']*)(\.[A-Z][_a-zA-Z0-9']*)*)(\s+(as)\s+(([A-Z][_a-zA-Z0-9']*)(\.[A-Z][_a-zA-Z0-9']*)*))?(\s+hiding\b)?/m,inside:{keyword:/\b(import|qualified|as|hiding)\b/}},builtin:/\b(abs|acos|acosh|all|and|any|appendFile|approxRational|asTypeOf|asin|asinh|atan|atan2|atanh|basicIORun|break|catch|ceiling|chr|compare|concat|concatMap|const|cos|cosh|curry|cycle|decodeFloat|denominator|digitToInt|div|divMod|drop|dropWhile|either|elem|encodeFloat|enumFrom|enumFromThen|enumFromThenTo|enumFromTo|error|even|exp|exponent|fail|filter|flip|floatDigits|floatRadix|floatRange|floor|fmap|foldl|foldl1|foldr|foldr1|fromDouble|fromEnum|fromInt|fromInteger|fromIntegral|fromRational|fst|gcd|getChar|getContents|getLine|group|head|id|inRange|index|init|intToDigit|interact|ioError|isAlpha|isAlphaNum|isAscii|isControl|isDenormalized|isDigit|isHexDigit|isIEEE|isInfinite|isLower|isNaN|isNegativeZero|isOctDigit|isPrint|isSpace|isUpper|iterate|last|lcm|length|lex|lexDigits|lexLitChar|lines|log|logBase|lookup|map|mapM|mapM_|max|maxBound|maximum|maybe|min|minBound|minimum|mod|negate|not|notElem|null|numerator|odd|or|ord|otherwise|pack|pi|pred|primExitWith|print|product|properFraction|putChar|putStr|putStrLn|quot|quotRem|range|rangeSize|read|readDec|readFile|readFloat|readHex|readIO|readInt|readList|readLitChar|readLn|readOct|readParen|readSigned|reads|readsPrec|realToFrac|recip|rem|repeat|replicate|return|reverse|round|scaleFloat|scanl|scanl1|scanr|scanr1|seq|sequence|sequence_|show|showChar|showInt|showList|showLitChar|showParen|showSigned|showString|shows|showsPrec|significand|signum|sin|sinh|snd|sort|span|splitAt|sqrt|subtract|succ|sum|tail|take|takeWhile|tan|tanh|threadToIOResult|toEnum|toInt|toInteger|toLower|toRational|toUpper|truncate|uncurry|undefined|unlines|until|unwords|unzip|unzip3|userError|words|writeFile|zip|zip3|zipWith|zipWith3)\b/,number:/\b(\d+(\.\d+)?([eE][+-]?\d+)?|0[Oo][0-7]+|0[Xx][0-9a-fA-F]+)\b/,operator:/\s\.\s|([-!#$%*+=\?&@|~:<>^\\]*\.[-!#$%*+=\?&@|~:<>^\\]+)|([-!#$%*+=\?&@|~:<>^\\]+\.[-!#$%*+=\?&@|~:<>^\\]*)|[-!#$%*+=\?&@|~:<>^\\]+|(`([A-Z][_a-zA-Z0-9']*\.)*[_a-z][_a-zA-Z0-9']*`)/,hvariable:/\b([A-Z][_a-zA-Z0-9']*\.)*[_a-z][_a-zA-Z0-9']*\b/,constant:/\b([A-Z][_a-zA-Z0-9']*\.)*[A-Z][_a-zA-Z0-9']*\b/,punctuation:/[{}[\];(),.:]/};
|
|
@ -1,44 +0,0 @@
|
|||
Prism.languages.http = {
|
||||
'request-line': {
|
||||
pattern: /^(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b\shttps?:\/\/\S+\sHTTP\/[0-9.]+/,
|
||||
inside: {
|
||||
// HTTP Verb
|
||||
property: /^\b(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b/,
|
||||
// Path or query argument
|
||||
'attr-name': /:\w+/
|
||||
}
|
||||
},
|
||||
'response-status': {
|
||||
pattern: /^HTTP\/1.[01] [0-9]+.*/,
|
||||
inside: {
|
||||
// Status, e.g. 200 OK
|
||||
property: /[0-9]+[A-Z\s-]+$/i
|
||||
}
|
||||
},
|
||||
// HTTP header name
|
||||
keyword: /^[\w-]+:(?=.+)/m
|
||||
};
|
||||
|
||||
// Create a mapping of Content-Type headers to language definitions
|
||||
var httpLanguages = {
|
||||
'application/json': Prism.languages.javascript,
|
||||
'application/xml': Prism.languages.markup,
|
||||
'text/xml': Prism.languages.markup,
|
||||
'text/html': Prism.languages.markup
|
||||
};
|
||||
|
||||
// Insert each content type parser that has its associated language
|
||||
// currently loaded.
|
||||
for (var contentType in httpLanguages) {
|
||||
if (httpLanguages[contentType]) {
|
||||
var options = {};
|
||||
options[contentType] = {
|
||||
pattern: new RegExp('(content-type:\\s*' + contentType + '[\\w\\W]*?)\\n\\n[\\w\\W]*', 'i'),
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: httpLanguages[contentType]
|
||||
}
|
||||
};
|
||||
Prism.languages.insertBefore('http', 'keyword', options);
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.http={"request-line":{pattern:/^(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b\shttps?:\/\/\S+\sHTTP\/[0-9.]+/,inside:{property:/^\b(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b/,"attr-name":/:\w+/}},"response-status":{pattern:/^HTTP\/1.[01] [0-9]+.*/,inside:{property:/[0-9]+[A-Z\s-]+$/i}},keyword:/^[\w-]+:(?=.+)/m};var httpLanguages={"application/json":Prism.languages.javascript,"application/xml":Prism.languages.markup,"text/xml":Prism.languages.markup,"text/html":Prism.languages.markup};for(var contentType in httpLanguages)if(httpLanguages[contentType]){var options={};options[contentType]={pattern:new RegExp("(content-type:\\s*"+contentType+"[\\w\\W]*?)\\n\\n[\\w\\W]*","i"),lookbehind:!0,inside:{rest:httpLanguages[contentType]}},Prism.languages.insertBefore("http","keyword",options)}
|
|
@ -1,11 +0,0 @@
|
|||
Prism.languages.ini= {
|
||||
'comment': /^\s*;.*$/m,
|
||||
'important': /\[.*?\]/m,
|
||||
'constant': /^\s*[^\s=]+?(?=[ \t]*=)/m,
|
||||
'attr-value': {
|
||||
pattern: /=.*/m,
|
||||
inside: {
|
||||
'punctuation': /^[=]/
|
||||
}
|
||||
}
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.ini={comment:/^\s*;.*$/m,important:/\[.*?\]/m,constant:/^\s*[^\s=]+?(?=[ \t]*=)/m,"attr-value":{pattern:/=.*/m,inside:{punctuation:/^[=]/}}};
|
|
@ -1,196 +0,0 @@
|
|||
(function(Prism) {
|
||||
Prism.languages.jade = {
|
||||
|
||||
// Multiline stuff should appear before the rest
|
||||
|
||||
'multiline-comment': {
|
||||
pattern: /((?:^|\n)([\t ]*))\/\/.*(\n\2[\t ]+.+)*/,
|
||||
lookbehind: true,
|
||||
alias: 'comment'
|
||||
},
|
||||
|
||||
// All the tag-related part is in lookbehind
|
||||
// so that it can be highlighted by the "tag" pattern
|
||||
'multiline-script': {
|
||||
pattern: /((?:^|\n)([\t ]*)script\b.*\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.javascript
|
||||
}
|
||||
},
|
||||
|
||||
// See at the end of the file for known filters
|
||||
'filter': {
|
||||
pattern: /((?:^|\n)([\t ]*)):.+(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'filter-name': {
|
||||
pattern: /^:[\w-]+/,
|
||||
alias: 'variable'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
'multiline-plain-text': {
|
||||
pattern: /((?:^|\n)([\t ]*)[\w\-#.]+\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,
|
||||
lookbehind: true
|
||||
},
|
||||
'markup': {
|
||||
pattern: /((?:^|\n)[\t ]*)<.+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.markup
|
||||
}
|
||||
},
|
||||
'comment': {
|
||||
pattern: /((?:^|\n)[\t ]*)\/\/.+/,
|
||||
lookbehind: true
|
||||
},
|
||||
'doctype': {
|
||||
pattern: /((?:^|\n)[\t ]*)doctype(?: .+)?/,
|
||||
lookbehind: true
|
||||
},
|
||||
|
||||
// This handle all conditional and loop keywords
|
||||
'flow-control': {
|
||||
pattern: /((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|each|while)(?: .+)?/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'each': {
|
||||
pattern: /((?:^|\n)[\t ]*)each .+? in\b/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'keyword': /\b(?:each|in)\b/,
|
||||
'punctuation': /,/
|
||||
}
|
||||
},
|
||||
'branch': {
|
||||
pattern: /((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|while)/,
|
||||
lookbehind: true,
|
||||
alias: 'keyword'
|
||||
},
|
||||
rest: Prism.languages.javascript
|
||||
}
|
||||
},
|
||||
'keyword': {
|
||||
pattern: /((?:^|\n)[\t ]*)(?:block|extends|include|append|prepend)\b.+/,
|
||||
lookbehind: true
|
||||
},
|
||||
'mixin': [
|
||||
// Declaration
|
||||
{
|
||||
pattern: /((?:^|\n)[\t ]*)mixin .+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'keyword': /^mixin/,
|
||||
'function': /\w+(?=\s*\(|\s*$)/,
|
||||
'punctuation': /[(),.]/
|
||||
}
|
||||
},
|
||||
// Usage
|
||||
{
|
||||
pattern: /((?:^|\n)[\t ]*)\+.+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'name': {
|
||||
pattern: /^\+\w+/,
|
||||
alias: 'function'
|
||||
},
|
||||
'rest': Prism.languages.javascript
|
||||
}
|
||||
}
|
||||
],
|
||||
'script': {
|
||||
pattern: /((?:^|\n)[\t ]*script(?:(?:&[^(]+)?\([^)]+\))*) .+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.javascript
|
||||
}
|
||||
},
|
||||
|
||||
'plain-text': {
|
||||
pattern: /((?:^|\n)[\t ]*(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?[\t ]+).+/,
|
||||
lookbehind: true
|
||||
},
|
||||
'tag': {
|
||||
pattern: /((?:^|\n)[\t ]*)(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?:?/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'attributes': [
|
||||
{
|
||||
pattern: /&[^(]+\([^)]+\)/,
|
||||
inside: {
|
||||
rest: Prism.languages.javascript
|
||||
}
|
||||
},
|
||||
{
|
||||
pattern: /\([^)]+\)/,
|
||||
inside: {
|
||||
'attr-value': {
|
||||
pattern: /(=\s*)(?:\{[^}]*\}|[^,)\n]+)/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.javascript
|
||||
}
|
||||
},
|
||||
'attr-name': /[\w-]+(?=\s*!?=|\s*[,)])/,
|
||||
'punctuation': /[!=(),]/
|
||||
}
|
||||
}
|
||||
],
|
||||
'punctuation': /[:]/
|
||||
}
|
||||
},
|
||||
'code': [
|
||||
{
|
||||
pattern: /((?:^|\n)[\t ]*(?:-|!?=)).+/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
rest: Prism.languages.javascript
|
||||
}
|
||||
}
|
||||
],
|
||||
'punctuation': /[.\-!=|]/
|
||||
};
|
||||
|
||||
var filter_pattern = '((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+';
|
||||
|
||||
// Non exhaustive list of available filters and associated languages
|
||||
var filters = [
|
||||
{filter:'atpl',language:'twig'},
|
||||
{filter:'coffee',language:'coffeescript'},
|
||||
'ejs',
|
||||
'handlebars',
|
||||
'hogan',
|
||||
'less',
|
||||
'livescript',
|
||||
'markdown',
|
||||
'mustache',
|
||||
'plates',
|
||||
{filter:'sass',language:'scss'},
|
||||
'stylus',
|
||||
'swig'
|
||||
|
||||
];
|
||||
var all_filters = {};
|
||||
for (var i = 0, l = filters.length; i < l; i++) {
|
||||
var filter = filters[i];
|
||||
filter = typeof filter === 'string' ? {filter: filter, language: filter} : filter;
|
||||
if (Prism.languages[filter.language]) {
|
||||
all_filters['filter-' + filter.filter] = {
|
||||
pattern: RegExp(filter_pattern.replace('{{filter_name}}', filter.filter)),
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'filter-name': {
|
||||
pattern: /^:[\w-]+/,
|
||||
alias: 'variable'
|
||||
},
|
||||
rest: Prism.languages[filter.language]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Prism.languages.insertBefore('jade', 'filter', all_filters);
|
||||
|
||||
}(Prism));
|
|
@ -1 +0,0 @@
|
|||
!function(e){e.languages.jade={"multiline-comment":{pattern:/((?:^|\n)([\t ]*))\/\/.*(\n\2[\t ]+.+)*/,lookbehind:!0,alias:"comment"},"multiline-script":{pattern:/((?:^|\n)([\t ]*)script\b.*\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0,inside:{rest:e.languages.javascript}},filter:{pattern:/((?:^|\n)([\t ]*)):.+(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"}}},"multiline-plain-text":{pattern:/((?:^|\n)([\t ]*)[\w\-#.]+\.[\t ]*)(\n(?:\2[\t ]+.+|\s*?(?=\n)))+/,lookbehind:!0},markup:{pattern:/((?:^|\n)[\t ]*)<.+/,lookbehind:!0,inside:{rest:e.languages.markup}},comment:{pattern:/((?:^|\n)[\t ]*)\/\/.+/,lookbehind:!0},doctype:{pattern:/((?:^|\n)[\t ]*)doctype(?: .+)?/,lookbehind:!0},"flow-control":{pattern:/((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|each|while)(?: .+)?/,lookbehind:!0,inside:{each:{pattern:/((?:^|\n)[\t ]*)each .+? in\b/,lookbehind:!0,inside:{keyword:/\b(?:each|in)\b/,punctuation:/,/}},branch:{pattern:/((?:^|\n)[\t ]*)(?:if|unless|else|case|when|default|while)/,lookbehind:!0,alias:"keyword"},rest:e.languages.javascript}},keyword:{pattern:/((?:^|\n)[\t ]*)(?:block|extends|include|append|prepend)\b.+/,lookbehind:!0},mixin:[{pattern:/((?:^|\n)[\t ]*)mixin .+/,lookbehind:!0,inside:{keyword:/^mixin/,"function":/\w+(?=\s*\(|\s*$)/,punctuation:/[(),.]/}},{pattern:/((?:^|\n)[\t ]*)\+.+/,lookbehind:!0,inside:{name:{pattern:/^\+\w+/,alias:"function"},rest:e.languages.javascript}}],script:{pattern:/((?:^|\n)[\t ]*script(?:(?:&[^(]+)?\([^)]+\))*) .+/,lookbehind:!0,inside:{rest:e.languages.javascript}},"plain-text":{pattern:/((?:^|\n)[\t ]*(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?[\t ]+).+/,lookbehind:!0},tag:{pattern:/((?:^|\n)[\t ]*)(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?:?/,lookbehind:!0,inside:{attributes:[{pattern:/&[^(]+\([^)]+\)/,inside:{rest:e.languages.javascript}},{pattern:/\([^)]+\)/,inside:{"attr-value":{pattern:/(=\s*)(?:\{[^}]*\}|[^,)\n]+)/,lookbehind:!0,inside:{rest:e.languages.javascript}},"attr-name":/[\w-]+(?=\s*!?=|\s*[,)])/,punctuation:/[!=(),]/}}],punctuation:/[:]/}},code:[{pattern:/((?:^|\n)[\t ]*(?:-|!?=)).+/,lookbehind:!0,inside:{rest:e.languages.javascript}}],punctuation:/[.\-!=|]/};for(var t="((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+",n=[{filter:"atpl",language:"twig"},{filter:"coffee",language:"coffeescript"},"ejs","handlebars","hogan","less","livescript","markdown","mustache","plates",{filter:"sass",language:"scss"},"stylus","swig"],a={},i=0,s=n.length;s>i;i++){var l=n[i];l="string"==typeof l?{filter:l,language:l}:l,e.languages[l.language]&&(a["filter-"+l.filter]={pattern:RegExp(t.replace("{{filter_name}}",l.filter)),lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"},rest:e.languages[l.language]}})}e.languages.insertBefore("jade","filter",a)}(Prism);
|
|
@ -1,8 +0,0 @@
|
|||
Prism.languages.java = Prism.languages.extend('clike', {
|
||||
'keyword': /\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/,
|
||||
'number': /\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+[e]?[\d]*[df]\b|\b\d*\.?\d+\b/i,
|
||||
'operator': {
|
||||
pattern: /(^|[^\.])(?:\+=|\+\+?|-=|--?|!=?|<{1,2}=?|>{1,3}=?|==?|&=|&&?|\|=|\|\|?|\?|\*=?|\/=?|%=?|\^=?|:|~)/m,
|
||||
lookbehind: true
|
||||
}
|
||||
});
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.java=Prism.languages.extend("clike",{keyword:/\b(abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while)\b/,number:/\b0b[01]+\b|\b0x[\da-f]*\.?[\da-fp\-]+\b|\b\d*\.?\d+[e]?[\d]*[df]\b|\b\d*\.?\d+\b/i,operator:{pattern:/(^|[^\.])(?:\+=|\+\+?|-=|--?|!=?|<{1,2}=?|>{1,3}=?|==?|&=|&&?|\|=|\|\|?|\?|\*=?|\/=?|%=?|\^=?|:|~)/m,lookbehind:!0}});
|
|
@ -1,47 +0,0 @@
|
|||
Prism.languages.javascript = Prism.languages.extend('clike', {
|
||||
'keyword': /\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/,
|
||||
'number': /\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,
|
||||
'function': /(?!\d)[a-z0-9_$]+(?=\()/i
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('javascript', 'keyword', {
|
||||
'regex': {
|
||||
pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,
|
||||
lookbehind: true
|
||||
}
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('javascript', 'class-name', {
|
||||
'template-string': {
|
||||
pattern: /`(?:\\`|\\?[^`])*`/,
|
||||
inside: {
|
||||
'interpolation': {
|
||||
pattern: /\$\{[^}]+\}/,
|
||||
inside: {
|
||||
'interpolation-punctuation': {
|
||||
pattern: /^\$\{|\}$/,
|
||||
alias: 'punctuation'
|
||||
},
|
||||
rest: Prism.languages.javascript
|
||||
}
|
||||
},
|
||||
'string': /[\s\S]+/
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (Prism.languages.markup) {
|
||||
Prism.languages.insertBefore('markup', 'tag', {
|
||||
'script': {
|
||||
pattern: /<script[\w\W]*?>[\w\W]*?<\/script>/i,
|
||||
inside: {
|
||||
'tag': {
|
||||
pattern: /<script[\w\W]*?>|<\/script>/i,
|
||||
inside: Prism.languages.markup.tag.inside
|
||||
},
|
||||
rest: Prism.languages.javascript
|
||||
},
|
||||
alias: 'language-javascript'
|
||||
}
|
||||
});
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/(?!\d)[a-z0-9_$]+(?=\()/i}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}}),Prism.languages.insertBefore("javascript","class-name",{"template-string":{pattern:/`(?:\\`|\\?[^`])*`/,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/<script[\w\W]*?>[\w\W]*?<\/script>/i,inside:{tag:{pattern:/<script[\w\W]*?>|<\/script>/i,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript},alias:"language-javascript"}});
|
|
@ -1,22 +0,0 @@
|
|||
(function(Prism) {
|
||||
|
||||
var javascript = Prism.util.clone(Prism.languages.javascript);
|
||||
|
||||
Prism.languages.jsx = Prism.languages.extend('markup', javascript);
|
||||
Prism.languages.jsx.tag.pattern= /<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+|(\{[\w\W]*?\})))?\s*)*\/?>/i;
|
||||
|
||||
Prism.languages.jsx.tag.inside['attr-value'].pattern = /=[^\{](?:('|")[\w\W]*?(\1)|[^\s>]+)/i;
|
||||
|
||||
Prism.languages.insertBefore('inside', 'attr-value',{
|
||||
'script': {
|
||||
pattern: /=(\{[\w\W]*?\})/i,
|
||||
inside: {
|
||||
'function' : Prism.languages.javascript.function,
|
||||
'punctuation': /[={}[\];(),.:]/,
|
||||
'keyword': Prism.languages.javascript.keyword
|
||||
},
|
||||
'alias': 'language-javascript'
|
||||
}
|
||||
}, Prism.languages.jsx.tag);
|
||||
|
||||
}(Prism));
|
|
@ -1 +0,0 @@
|
|||
!function(a){var s=a.util.clone(a.languages.javascript);a.languages.jsx=a.languages.extend("markup",s),a.languages.jsx.tag.pattern=/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+|(\{[\w\W]*?\})))?\s*)*\/?>/i,a.languages.jsx.tag.inside["attr-value"].pattern=/=[^\{](?:('|")[\w\W]*?(\1)|[^\s>]+)/i,a.languages.insertBefore("inside","attr-value",{script:{pattern:/=(\{[\w\W]*?\})/i,inside:{"function":a.languages.javascript.function,punctuation:/[={}[\];(),.:]/,keyword:a.languages.javascript.keyword},alias:"language-javascript"}},a.languages.jsx.tag)}(Prism);
|
|
@ -1,12 +0,0 @@
|
|||
Prism.languages.julia= {
|
||||
'comment': {
|
||||
pattern: /(^|[^\\])#.*?(\r?\n|$)/,
|
||||
lookbehind: true
|
||||
},
|
||||
'string': /"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(\\?.)*?\1/,
|
||||
'keyword' : /\b(abstract|baremodule|begin|bitstype|break|catch|ccall|const|continue|do|else|elseif|end|export|finally|for|function|global|if|immutable|import|importall|let|local|macro|module|print|println|quote|return|try|type|typealias|using|while)\b/,
|
||||
'boolean' : /\b(true|false)\b/,
|
||||
'number' : /\b-?(0[box])?(?:[\da-f]+\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,
|
||||
'operator' : /[-+]{1,2}|=?<|=?>|!|={1,2}|&{1,2}|\|?\||\?|\*|\/|~|\^|%|\b(or|and|not)\b/,
|
||||
'punctuation' : /[{}[\];(),.:]/
|
||||
};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue