-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from candrews/yaml
YAML Highlighter
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* SyntaxHighlighter | ||
* http://alexgorbatchev.com/SyntaxHighlighter | ||
* | ||
* SyntaxHighlighter is donationware. If you are using it, please donate. | ||
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html | ||
* | ||
* @copyright | ||
* Copyright (C) 2019 Craig Andrews. | ||
* Copyright (C) 2016 Erik Wegner. | ||
* | ||
* @license | ||
* Dual licensed under the MIT and GPL licenses. | ||
*/ | ||
;(function() | ||
{ | ||
// CommonJS | ||
SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null); | ||
|
||
function Brush() | ||
{ | ||
|
||
// Yaml Brush | ||
|
||
var constants = '~ true false on off'; | ||
|
||
this.regexList = [ | ||
{ regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // comment | ||
{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted string | ||
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted string | ||
{ regex: /^\s*([a-z0-9\._-])+\s*:/gmi, css: 'variable' }, // key | ||
{ regex: /\s?(\.)([a-z0-9\._-])+\s?:/gmi, css: 'comments' }, // section | ||
{ regex: /\s(@|:)([a-z0-9\._-])+\s*$/gmi, css: 'variable bold' }, // variable, reference | ||
{ regex: /\s+\d+\s?$/gm, css: 'color2 bold' }, // integers | ||
{ regex: /(\{|\}|\[|\]|,|~|:)/gm, css: 'constants' }, // inline hash and array, comma, null | ||
{ regex: /^\s+(-)+/gm, css: 'string bold' }, // array list entry | ||
{ regex: /^---/gm, css: 'string bold' }, // category | ||
{ regex: new RegExp(this.getKeywords(constants), 'gmi'), css: 'constants' } // constants | ||
]; | ||
|
||
this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags); | ||
} | ||
Brush.prototype = new SyntaxHighlighter.Highlighter(); | ||
Brush.aliases = ['yaml', 'yml']; | ||
|
||
SyntaxHighlighter.brushes.Yaml = Brush; | ||
|
||
// CommonJS | ||
typeof(exports) != 'undefined' ? exports.Brush = Brush : null; | ||
})(); |