From 03d0ef79b4e9a47e9f59323e8795ecb3f9f4b742 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Sun, 23 Nov 2014 23:59:02 -0500 Subject: [PATCH 1/2] git: Match `---` and `+++` as well. This is more consistent with other syntax highlighting engines like GitHub's and Pygment. Signed-off-by: Timothy Gu --- components/prism-git.js | 4 ++-- components/prism-git.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/prism-git.js b/components/prism-git.js index 745966545f..b0e99d0876 100644 --- a/components/prism-git.js +++ b/components/prism-git.js @@ -51,8 +51,8 @@ Prism.languages.git = { /* * Regexp to match the changed lines in a git diff output. Check the example above. */ - 'deleted': /^-(?!-).+$/m, - 'inserted': /^\+(?!\+).+$/m, + 'deleted': /^-.*$/m, + 'inserted': /^\+.*$/m, /* * Match a "commit [SHA1]" line in a git log output. diff --git a/components/prism-git.min.js b/components/prism-git.min.js index 7ba2782e89..b11fd5282c 100644 --- a/components/prism-git.min.js +++ b/components/prism-git.min.js @@ -1 +1 @@ -Prism.languages.git={comment:/^#.*$/m,string:/("|')(\\?.)*?\1/gm,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s(--|-)\w+/m}},coord:/^@@.*@@$/m,deleted:/^-(?!-).+$/m,inserted:/^\+(?!\+).+$/m,commit_sha1:/^commit \w{40}$/m} +Prism.languages.git={comment:/^#.*$/m,string:/("|')(\\?.)*?\1/gm,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s(--|-)\w+/m}},coord:/^@@.*@@$/m,deleted:/^-.*$/m,inserted:/^\+.*$/m,commit_sha1:/^commit \w{40}$/m} From 3df22810755a2dce99001350985372428a936f39 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Mon, 24 Nov 2014 00:06:54 -0500 Subject: [PATCH 2/2] Add styles for diff coordinates Signed-off-by: Timothy Gu --- themes/prism-coy.css | 3 ++- themes/prism-dark.css | 3 ++- themes/prism-funky.css | 3 ++- themes/prism-okaidia.css | 3 ++- themes/prism-tomorrow.css | 3 ++- themes/prism-twilight.css | 3 ++- themes/prism.css | 4 +++- 7 files changed, 15 insertions(+), 7 deletions(-) diff --git a/themes/prism-coy.css b/themes/prism-coy.css index f8954bb1a2..83290203d4 100644 --- a/themes/prism-coy.css +++ b/themes/prism-coy.css @@ -151,7 +151,8 @@ pre[class*="language-"]:after { .token.atrule, .token.attr-value, .token.keyword, -.token.class-name { +.token.class-name, +.token.coord { color: #1990b8; } diff --git a/themes/prism-dark.css b/themes/prism-dark.css index 5cabfa72de..f419f8b702 100644 --- a/themes/prism-dark.css +++ b/themes/prism-dark.css @@ -100,7 +100,8 @@ pre[class*="language-"] { .token.atrule, .token.attr-value, -.token.keyword { +.token.keyword, +.token.coord { color: hsl(350, 40%, 70%); } diff --git a/themes/prism-funky.css b/themes/prism-funky.css index d2138254b7..46a913c2fe 100644 --- a/themes/prism-funky.css +++ b/themes/prism-funky.css @@ -89,7 +89,8 @@ code[class*="language-"] { .token.atrule, .token.attr-value, -.token.keyword { +.token.keyword, +.token.coord { color: deeppink; } diff --git a/themes/prism-okaidia.css b/themes/prism-okaidia.css index 8be4b0bdbf..185c3d0e45 100644 --- a/themes/prism-okaidia.css +++ b/themes/prism-okaidia.css @@ -96,7 +96,8 @@ pre[class*="language-"] { color: #e6db74; } -.token.keyword { +.token.keyword, +.token.coord { color: #66d9ef; } diff --git a/themes/prism-tomorrow.css b/themes/prism-tomorrow.css index e41de8da82..5dc34f69b5 100644 --- a/themes/prism-tomorrow.css +++ b/themes/prism-tomorrow.css @@ -84,7 +84,8 @@ pre[class*="language-"] { .token.important, .token.atrule, .token.keyword, -.token.builtin { +.token.builtin, +.token.coord { color: #cc99cd; } diff --git a/themes/prism-twilight.css b/themes/prism-twilight.css index aa7b901fd6..dcdcc092a2 100644 --- a/themes/prism-twilight.css +++ b/themes/prism-twilight.css @@ -98,7 +98,8 @@ code[class*="language-"]::selection, code[class*="language-"] ::selection { .token.selector, .token.constant, .token.symbol, -.token.builtin { +.token.builtin, +.token.coord { color: hsl(53, 89%, 79%); /* #F9EE98 */ } diff --git a/themes/prism.css b/themes/prism.css index 3a9a1e6049..f8b01cc313 100644 --- a/themes/prism.css +++ b/themes/prism.css @@ -108,7 +108,8 @@ pre[class*="language-"] { .token.atrule, .token.attr-value, -.token.keyword { +.token.keyword, +.token.coord { color: #07a; } @@ -129,3 +130,4 @@ pre[class*="language-"] { .token.entity { cursor: help; } +