Index: lib/src/prism/components/prism-diff.js |
diff --git a/lib/src/prism/components/prism-diff.js b/lib/src/prism/components/prism-diff.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3c5351c0b6753870552e07e4f9e3521504837946 |
--- /dev/null |
+++ b/lib/src/prism/components/prism-diff.js |
@@ -0,0 +1,20 @@ |
+Prism.languages.diff = { |
+ 'coord': [ |
+ // Match all kinds of coord lines (prefixed by "+++", "---" or "***"). |
+ /^(?:\*{3}|-{3}|\+{3}).*$/m, |
+ // Match "@@ ... @@" coord lines in unified diff. |
+ /^@@.*@@$/m, |
+ // Match coord lines in normal diff (starts with a number). |
+ /^\d+.*$/m |
+ ], |
+ |
+ // Match inserted and deleted lines. Support both +/- and >/< styles. |
+ 'deleted': /^[-<].+$/m, |
+ 'inserted': /^[+>].+$/m, |
+ |
+ // Match "different" lines (prefixed with "!") in context diff. |
+ 'diff': { |
+ 'pattern': /^!(?!!).+$/m, |
+ 'alias': 'important' |
+ } |
+}; |