-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for EditorConfig (#2471)
- Loading branch information
Showing
10 changed files
with
146 additions
and
2 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,21 @@ | ||
Prism.languages.editorconfig = { | ||
// https://editorconfig-specification.readthedocs.io/en/latest/ | ||
'comment': /[;#].*/, | ||
'section': { | ||
pattern: /^[ \t]*\[.+]/m, | ||
alias: 'keyword', | ||
inside: { | ||
'regex': /\\\\[\[\]{},!?.*]/, // Escape special characters with '\\' | ||
'operator': /[!?]|\.\.|\*{1,2}/, | ||
'punctuation': /[\[\]{},]/ | ||
} | ||
}, | ||
'property': /^[ \t]*[^\s=]+(?=[ \t]*=)/m, | ||
'value': { | ||
pattern: /=.*/, | ||
alias: 'string', | ||
inside: { | ||
'punctuation': /^=/ | ||
} | ||
} | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,47 @@ | ||
<h2>Comment</h2> | ||
<pre><code># This is a comment | ||
; And this is too</code></pre> | ||
|
||
<h2>Section Header</h2> | ||
<pre><code>[*] | ||
[*.js] | ||
[*.{bash,sh,zsh}]</code></pre> | ||
|
||
<h2>Key-Value Pair</h2> | ||
<pre><code>key = value | ||
indent_style = space</code></pre> | ||
|
||
<h2>Full example</h2> | ||
<pre><code># EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
# Matches multiple files with brace expansion notation | ||
# Set default charset | ||
[*.{js,py}] | ||
charset = utf-8 | ||
|
||
# 4 space indentation | ||
[*.py] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
# Tab indentation (no size specified) | ||
[Makefile] | ||
indent_style = tab | ||
|
||
# Indentation override for all JS under lib directory | ||
[lib/**.js] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
# Matches the exact files either package.json or .travis.yml | ||
[{package.json,.travis.yml}] | ||
indent_style = space | ||
indent_size = 2</code></pre> |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,15 @@ | ||
; | ||
; comment | ||
# comment can also contain ; and # | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["comment", ";"], | ||
["comment", "; comment"], | ||
["comment", "# comment can also contain ; and #"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for comments. |
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,21 @@ | ||
foo = Bar Baz | ||
foobar = 42 | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["property", "foo"], | ||
["value", [ | ||
["punctuation", "="], | ||
" Bar Baz" | ||
]], | ||
["property", "foobar"], | ||
["value", [ | ||
["punctuation", "="], | ||
" 42" | ||
]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for key/value pairs. |
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,34 @@ | ||
[*] | ||
[**.kt] | ||
[{**.kt, **.kts}] | ||
[?[!seq].log.{0..9}] | ||
[\\**.log] | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["section", [ | ||
["punctuation", "["], ["operator", "*"], ["punctuation", "]"] | ||
]], | ||
["section", [ | ||
["punctuation", "["], ["operator", "**"], ".kt", ["punctuation", "]"] | ||
]], | ||
["section", [ | ||
["punctuation", "["], ["punctuation", "{"], | ||
["operator", "**"], ".kt", ["punctuation", ","], ["operator", "**"], ".kts", | ||
["punctuation", "}"], ["punctuation", "]"] | ||
]], | ||
["section", [ | ||
["punctuation", "["], ["operator", "?"], | ||
["punctuation", "["], ["operator", "!"], "seq", ["punctuation", "]"], | ||
".log.", ["punctuation", "{"], "0", ["operator", ".."], "9", ["punctuation", "}"], | ||
["punctuation", "]"] | ||
]], | ||
["section", [ | ||
["punctuation", "["], ["regex", "\\\\*"], ["operator", "*"], ".log", ["punctuation", "]"] | ||
]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for section titles. |