-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #214 Add brush based on: https://github.com/syntaxhighlighter/brush-typescript/blob/07d5fa0a57527d2f11d601676ea68a6ab91d3e6d/brush.js
- Loading branch information
Showing
2 changed files
with
42 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,38 @@ | ||
SyntaxHighlighter.brushes.ts = function () { | ||
const keywords = | ||
"break case catch class continue " + | ||
"default delete do else enum export extends false " + | ||
"for function if implements import in instanceof " + | ||
"interface let new null package private protected " + | ||
"static return super switch " + | ||
"this throw true try typeof var while with yield" + | ||
" any bool declare get module never number public readonly set string"; // TypeScript-specific, everything above is common with JavaScript | ||
|
||
this.regexList = [ | ||
{ | ||
regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, | ||
css: "string", | ||
}, | ||
{ | ||
regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, | ||
css: "string", | ||
}, | ||
{ | ||
regex: SyntaxHighlighter.regexLib.singleLineCComments, | ||
css: "comments", | ||
}, | ||
{ | ||
regex: SyntaxHighlighter.regexLib.multiLineCComments, | ||
css: "comments", | ||
}, | ||
{ | ||
regex: new RegExp(this.getKeywords(keywords), "gm"), | ||
css: "keyword", | ||
}, | ||
]; | ||
|
||
this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags); | ||
}; | ||
|
||
SyntaxHighlighter.brushes.ts.prototype = new SyntaxHighlighter.Highlighter(); | ||
SyntaxHighlighter.brushes.ts.aliases = ["ts", "typescript"]; |