Skip to content

Commit 3fcce6f

Browse files
authored
Added support for .gitignore (#2481)
1 parent 0c30c58 commit 3fcce6f

File tree

11 files changed

+89
-3
lines changed

11 files changed

+89
-3
lines changed

components.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,20 @@
483483
"title": "Icon",
484484
"owner": "Golmote"
485485
},
486+
"ignore": {
487+
"title": ".ignore",
488+
"owner": "osipxd",
489+
"alias": [
490+
"gitignore",
491+
"hgignore",
492+
"npmignore"
493+
],
494+
"aliasTitles": {
495+
"gitignore": ".gitignore",
496+
"hgignore": ".hgignore",
497+
"npmignore": ".npmignore"
498+
}
499+
},
486500
"inform7": {
487501
"title": "Inform 7",
488502
"owner": "Golmote"

components/prism-ignore.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
(function (Prism) {
2+
Prism.languages.ignore = {
3+
// https://git-scm.com/docs/gitignore
4+
'comment': /^#.*/m,
5+
'entry': {
6+
pattern: /\S(?:.*(?:(?:\\ )|\S))?/,
7+
alias: 'string',
8+
inside: {
9+
'operator': /^!|\*\*?|\?/,
10+
'regex': {
11+
pattern: /(^|[^\\])\[[^\[\]]*\]/,
12+
lookbehind: true
13+
},
14+
'punctuation': /\//
15+
}
16+
}
17+
};
18+
19+
Prism.languages.gitignore = Prism.languages.ignore
20+
Prism.languages.hgignore = Prism.languages.ignore
21+
Prism.languages.npmignore = Prism.languages.ignore
22+
23+
}(Prism));

components/prism-ignore.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/prism-ignore.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<h2>Comment</h2>
2+
<pre><code># This is a comment</code></pre>
3+
4+
<h2>Entry</h2>
5+
<pre><code>file[1-3].txt
6+
.configs/**
7+
!.configs/shared.cfg</code></pre>

plugins/autoloader/prism-autoloader.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@
172172
"xls": "excel-formula",
173173
"gamemakerlanguage": "gml",
174174
"hs": "haskell",
175+
"gitignore": "ignore",
176+
"hgignore": "ignore",
177+
"npmignore": "ignore",
175178
"webmanifest": "json",
176179
"kt": "kotlin",
177180
"kts": "kotlin",

plugins/autoloader/prism-autoloader.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/show-language/prism-show-language.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@
8181
"hpkp": "HTTP Public-Key-Pins",
8282
"hsts": "HTTP Strict-Transport-Security",
8383
"ichigojam": "IchigoJam",
84+
"ignore": ".ignore",
85+
"gitignore": ".gitignore",
86+
"hgignore": ".hgignore",
87+
"npmignore": ".npmignore",
8488
"inform7": "Inform 7",
8589
"javadoc": "JavaDoc",
8690
"javadoclike": "JavaDoc-like",

plugins/show-language/prism-show-language.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Simple comment
2+
## A comment too
3+
\# Not a comment
4+
5+
----------------------------------------------------
6+
7+
[
8+
["comment", "# Simple comment"],
9+
["comment", "## A comment too"],
10+
["entry", ["\\# Not a comment"]]
11+
]
12+
13+
----------------------------------------------------
14+
15+
Checks for comments.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy