Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components.js

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,20 @@
"title": "Icon",
"owner": "Golmote"
},
"ignore": {
"title": ".ignore",
"owner": "osipxd",
"alias": [
"gitignore",
"hgignore",
"npmignore"
],
"aliasTitles": {
"gitignore": ".gitignore",
"hgignore": ".hgignore",
"npmignore": ".npmignore"
}
},
"inform7": {
"title": "Inform 7",
"owner": "Golmote"
Expand Down
23 changes: 23 additions & 0 deletions components/prism-ignore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
(function (Prism) {
Prism.languages.ignore = {
// https://git-scm.com/docs/gitignore
'comment': /^#.*/m,
'entry': {
pattern: /\S(?:.*(?:(?:\\ )|\S))?/,
alias: 'string',
inside: {
'operator': /^!|\*\*?|\?/,
'regex': {
pattern: /(^|[^\\])\[[^\[\]]*\]/,
lookbehind: true
},
'punctuation': /\//
}
}
};

Prism.languages.gitignore = Prism.languages.ignore
Prism.languages.hgignore = Prism.languages.ignore
Prism.languages.npmignore = Prism.languages.ignore

}(Prism));
1 change: 1 addition & 0 deletions components/prism-ignore.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions examples/prism-ignore.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<h2>Comment</h2>
<pre><code># This is a comment</code></pre>

<h2>Entry</h2>
<pre><code>file[1-3].txt
.configs/**
!.configs/shared.cfg</code></pre>
3 changes: 3 additions & 0 deletions plugins/autoloader/prism-autoloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@
"xls": "excel-formula",
"gamemakerlanguage": "gml",
"hs": "haskell",
"gitignore": "ignore",
"hgignore": "ignore",
"npmignore": "ignore",
"webmanifest": "json",
"kt": "kotlin",
"kts": "kotlin",
Expand Down
2 changes: 1 addition & 1 deletion plugins/autoloader/prism-autoloader.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions plugins/show-language/prism-show-language.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@
"hpkp": "HTTP Public-Key-Pins",
"hsts": "HTTP Strict-Transport-Security",
"ichigojam": "IchigoJam",
"ignore": ".ignore",
"gitignore": ".gitignore",
"hgignore": ".hgignore",
"npmignore": ".npmignore",
"inform7": "Inform 7",
"javadoc": "JavaDoc",
"javadoclike": "JavaDoc-like",
Expand Down
2 changes: 1 addition & 1 deletion plugins/show-language/prism-show-language.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions tests/languages/ignore/comment_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Simple comment
## A comment too
\# Not a comment

----------------------------------------------------

[
["comment", "# Simple comment"],
["comment", "## A comment too"],
["entry", ["\\# Not a comment"]]
]

----------------------------------------------------

Checks for comments.
Loading