-
Notifications
You must be signed in to change notification settings - Fork 867
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add modern template customization options
- Loading branch information
Showing
19 changed files
with
348 additions
and
47 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
File renamed without changes.
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,11 @@ | ||
/* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License.txt in the project root for license information. */ | ||
|
||
export default { | ||
icons: [ | ||
{ | ||
icon: 'github', | ||
href: 'https://github.com/dotnet/docfx', | ||
title: 'GitHub' | ||
} | ||
] | ||
} |
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
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,156 @@ | ||
/** | ||
Origin: https://github.com/Duncanma/highlight.js/blob/stable/src/languages/bicep.js | ||
*/ | ||
|
||
export function bicep(hljs) { | ||
var bounded = function (text) { return "\\b" + text + "\\b"; }; | ||
var after = function (regex) { return "(?<=" + regex + ")"; }; | ||
var notAfter = function (regex) { return "(?<!" + regex + ")"; }; | ||
var before = function (regex) { return "(?=" + regex + ")"; }; | ||
var notBefore = function (regex) { return "(?!" + regex + ")"; }; | ||
var identifierStart = "[_a-zA-Z]"; | ||
var identifierContinue = "[_a-zA-Z0-9]"; | ||
var identifier = bounded("" + identifierStart + identifierContinue + "*"); | ||
// whitespace. ideally we'd tokenize in-line block comments, but that's a lot of work. For now, ignore them. | ||
var ws = "(?:[ \\t\\r\\n]|\\/\\*(?:\\*(?!\\/)|[^*])*\\*\\/)*"; | ||
var KEYWORDS = { | ||
$pattern: '[A-Za-z$_][0-9A-Za-z$_]*', | ||
keyword: [ | ||
'targetScope', | ||
'resource', | ||
'module', | ||
'param', | ||
'var', | ||
'output', | ||
'for', | ||
'in', | ||
'if', | ||
'existing', | ||
].join(' '), | ||
literal: [ | ||
"true", | ||
"false", | ||
"null", | ||
].join(' '), | ||
built_in: [ | ||
'az', | ||
'sys', | ||
].join(' ') | ||
}; | ||
var lineComment = { | ||
className: 'comment', | ||
begin: "//", | ||
end: "$", | ||
relevance: 0, | ||
}; | ||
var blockComment = { | ||
className: 'comment', | ||
begin: "/\\*", | ||
end: "\\*/", | ||
relevance: 0, | ||
}; | ||
var comments = { | ||
variants: [lineComment, blockComment], | ||
}; | ||
function withComments(input) { | ||
return input.concat(comments); | ||
} | ||
var expression = { | ||
keywords: KEYWORDS, | ||
variants: [ | ||
/* placeholder filled later due to cycle*/ | ||
], | ||
}; | ||
var escapeChar = { | ||
begin: "\\\\(u{[0-9A-Fa-f]+}|n|r|t|\\\\|'|\\${)", | ||
}; | ||
var stringVerbatim = { | ||
className: 'string', | ||
begin: "'''", | ||
end: "'''", | ||
}; | ||
var stringSubstitution = { | ||
className: 'subst', | ||
begin: "(\\${)", | ||
end: "(})", | ||
contains: withComments([expression]), | ||
}; | ||
var stringLiteral = { | ||
className: 'string', | ||
begin: "'" + notBefore("''"), | ||
end: "'", | ||
contains: [ | ||
escapeChar, | ||
stringSubstitution | ||
], | ||
}; | ||
var numericLiteral = { | ||
className: "number", | ||
begin: "[0-9]+", | ||
}; | ||
var namedLiteral = { | ||
className: 'literal', | ||
begin: bounded("(true|false|null)"), | ||
relevance: 0, | ||
}; | ||
var identifierExpression = { | ||
className: "variable", | ||
begin: "" + identifier + notBefore(ws + "\\("), | ||
}; | ||
var objectPropertyKeyIdentifier = { | ||
className: "property", | ||
begin: "(" + identifier + ")", | ||
}; | ||
var objectProperty = { | ||
variants: [ | ||
objectPropertyKeyIdentifier, | ||
stringLiteral, | ||
{ | ||
begin: ":" + ws, | ||
excludeBegin: true, | ||
end: ws + "$", | ||
excludeEnd: true, | ||
contains: withComments([expression]), | ||
}, | ||
], | ||
}; | ||
var objectLiteral = { | ||
begin: "{", | ||
end: "}", | ||
contains: withComments([objectProperty]), | ||
}; | ||
var arrayLiteral = { | ||
begin: "\\[" + notBefore("" + ws + bounded("for")), | ||
end: "]", | ||
contains: withComments([expression]), | ||
}; | ||
var functionCall = { | ||
className: 'function', | ||
begin: "(" + identifier + ")" + ws + "\\(", | ||
end: "\\)", | ||
contains: withComments([expression]), | ||
}; | ||
var decorator = { | ||
className: 'meta', | ||
begin: "@" + ws + before(identifier), | ||
end: "", | ||
contains: withComments([functionCall]), | ||
}; | ||
expression.variants = [ | ||
stringLiteral, | ||
stringVerbatim, | ||
numericLiteral, | ||
namedLiteral, | ||
objectLiteral, | ||
arrayLiteral, | ||
identifierExpression, | ||
functionCall, | ||
decorator, | ||
]; | ||
return { | ||
aliases: ['bicep'], | ||
case_insensitive: true, | ||
keywords: KEYWORDS, | ||
contains: withComments([expression]), | ||
}; | ||
} |
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,19 @@ | ||
import { bicep } from './bicep.js' | ||
|
||
export default { | ||
icons: [ | ||
{ | ||
icon: 'github', | ||
href: 'https://github.com/dotnet/docfx', | ||
title: 'GitHub' | ||
}, | ||
{ | ||
icon: 'twitter', | ||
href: 'https://twitter.com/', | ||
title: 'Twitter' | ||
} | ||
], | ||
configureHljs: function (hljs) { | ||
hljs.registerLanguage('bicep', bicep); | ||
}, | ||
} |
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
Empty file.
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 @@ | ||
export default {} |
Oops, something went wrong.