|
fef8cd49
|
2014-08-10T08:24:02
|
|
Allow multiple tokens to be mapped to the same CSS class
In most languages there are different ways of declaring the same
constructs, but with the current implementation of Prism it is only
possible to define one pattern for a particular token type. This is not
a problem, as long as it is possible to match everything with one regex.
But sometimes it isn't easily possible to do that, especially if things
like `lookbehind` or `inside` are needed for one part but not for the
other. This patch splits the token type into two parts, whereby the
second part is optional: {token type}#{description}
For example there is a minor bug in the current definition of the
`clike` language, that could be solved with this patch:
The character immediately in front of a single line comment is
highlighted as a comment as well.
something// something
This is because both definitions for single and multiline comments have
to be matched with a single regex and the `lookbehind` parameter can
only be applied to the first captured string.
With this patch one could split the two definitions up and use
`lookbehind` for both, thereby eliminating the bug.
'comment': {
pattern: /(^|[^\\])\/\*[\w\W]*?\*\//g,
lookbehind: true
},
'comment#single-line': {
pattern: /(^|[^\\:])\/\/.*?(\r?\n|$)/g,
lookbehind: true
},
|
|
d4824538
|
2014-08-08T19:12:12
|
|
Added minified latex language definition
|
|
24bf8ab7
|
2014-08-08T13:16:06
|
|
Included LaTeX suggestions
|
|
657b089f
|
2014-08-06T19:44:18
|
|
Added initial LaTeX support
|
|
4247baec
|
2014-07-28T16:54:50
|
|
Fix conflicts.
|
|
ec93e86c
|
2014-07-24T12:51:18
|
|
Added Twig language
|
|
502ed6c1
|
2014-07-23T10:49:30
|
|
Don't set the `self` variable with `var`
Firefox directly shadows the global variable `self` if it is present (= in a worker). So we need to set `self` without `var self` but directly.
|
|
eb1cd1c9
|
2014-07-23T09:49:34
|
|
Fix workers
The issue is that in workers `window` is undefined.
Therefore, in the first line, `self` will be set to `{}`.
This will destroy the check for workers later on:
```js
if (!self.document) {
if (!self.addEventListener) {
// in Node.js
return self.Prism;
}
// In worker
// ...
}
```
because `self.addEventListener` will then be undefined (due to `self = {}`).
The fix is to make the check for the environment more clever:
1. check for the browser: `(typeof window !== 'undefined')`
2. check for a worker: `(typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)` (from http://stackoverflow.com/questions/7931182/reliably-detect-if-the-script-is-executing-in-a-web-worker)
3. assume we are in node
|
|
c960493e
|
2014-07-20T11:25:41
|
|
Update Objective-C rules based on #291
|
|
970338c2
|
2014-07-13T11:31:53
|
|
Merge pull request #294 from aviaryan/c-ini
ini now also highlights value
|
|
8beaa6fb
|
2014-07-13T13:26:00
|
|
fixed another bug with ini highlight
|
|
70677495
|
2014-07-13T12:51:06
|
|
ini now also highlights value
|
|
73855ea2
|
2014-07-12T12:41:40
|
|
Merge pull request #292 from aviaryan/c-autohotkey
updated autohotkey minified file
|
|
513a53af
|
2014-07-12T13:08:37
|
|
updated autohotkey minified file
|
|
550c81e7
|
2014-07-11T21:21:27
|
|
Fix for some serious bugs in C and C++ highlighter
< and > don't seem to work as they used to. So this patch replaces
them with the corresponding < or > sign like it was done in the clike
base language.
The pattern for macro statements was seriously flawed. It didn't allow
for macros with no argument like #else or #endif. This patch fixes the
problem and additionally adds support for multiline macros, which are
fairly common.
#define FOO(a, b, c) \
do { \
do_stuff_here \
do_more_stuff \
} while (0)
Furthermore the path of the #include macro is highlighted as a string.
#include <stdio.h>
#include "config.h"
C also allows for multiline strings in a similar way as multiline
macros.
"This is a \
multiline \
string"
|
|
a1047294
|
2014-07-11T12:40:46
|
|
Merge pull request #290 from aviaryan/c-autohotkey
updated autohotkey.js
|
|
41396d8d
|
2014-07-11T18:23:48
|
|
fixed some keywords
|
|
058f8e9d
|
2014-07-11T17:59:45
|
|
rearranged some keywords
|
|
a8c9775b
|
2014-07-11T15:55:23
|
|
enhanced autohotkey js
|
|
d5dd3be2
|
2014-07-11T12:00:49
|
|
updated ini minified file
|
|
d4f03482
|
2014-07-11T11:47:07
|
|
fixed bugs with ini highlight
|
|
af7a42a4
|
2014-07-10T19:25:02
|
|
Updated minified versions
|
|
bb997900
|
2014-07-10T17:15:14
|
|
alphabetically arranged keywords
|
|
d648f371
|
2014-07-10T13:51:29
|
|
added Ini highlighting
|
|
37c2c180
|
2014-07-09T15:04:15
|
|
added AutoHotkey highlighting
|
|
069fa6d8
|
2014-06-30T11:17:22
|
|
Update prism-sql.js
Faster and more reliable http://jsperf.com/javascript-multiline-regexp-workarounds
|
|
42ab9b44
|
2014-06-27T11:11:22
|
|
SQL : Multi lines strings
'string' regex modified to accept line breaks as SQL strings can use them.
|
|
e6ff300c
|
2014-06-26T04:04:42
|
|
Use tabs for indentation
|
|
62687ecc
|
2014-06-26T03:59:26
|
|
objc -> objectivec
|
|
c76f777d
|
2014-06-25T21:35:03
|
|
Add Objective-C syntax
|
|
e2c11520
|
2014-06-04T17:18:43
|
|
added newline to end of prism-swift.js
|
|
efc1d2bc
|
2014-06-04T17:13:37
|
|
added swift language
|
|
5d1cf199
|
2014-05-10T20:16:58
|
|
Recognize character
|
|
ee4b3838
|
2014-05-10T19:53:21
|
|
Recognize keywords
|
|
568728d9
|
2014-05-10T19:35:07
|
|
Recognize regex, symbol, string (crudely)
|
|
9d5a0969
|
2014-05-12T11:35:31
|
|
Recognize punctuation and reference
|
|
444c60f9
|
2014-05-10T19:32:08
|
|
Recognize boolean, date, time, datetime, number
|
|
dc45d573
|
2014-05-10T13:40:57
|
|
Simple start for Rip
Recognize comment, builtin, boolean
|
|
d27b693f
|
2014-06-01T17:18:03
|
|
Updated keywords in JavaScript definition
* Sort keywords alphabetically (to ease maintenance)
* Added all missing keywords
* Added ECMAScript 5 keywords
* Added true/false/null as explicit keywords
Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Reserved_Words
Fixes #270
|
|
7cfd29a9
|
2014-05-26T11:20:55
|
|
Rebuild minified files.
|
|
2323537a
|
2014-05-25T10:45:33
|
|
Merge pull request #266 from arnehormann/patch-1
replace entities with their literals
|
|
86fe1c88
|
2014-05-25T10:45:11
|
|
Merge pull request #267 from nauzilus/grammar-update
Remove escaped entities from pattern match.
|
|
d478d6aa
|
2014-05-25T09:20:51
|
|
Remove escaped entities from Java
|
|
b348fc62
|
2014-05-25T07:57:38
|
|
Remove escaped entities from pattern match.
|
|
a2acb949
|
2014-05-25T01:52:02
|
|
replace entities with their literals
|
|
4a472307
|
2014-05-24T16:14:20
|
|
Minified files
|
|
9ff5de1e
|
2014-05-24T16:13:33
|
|
Merge pull request #264 from robfletcher/gh-pages
#258 removed HTML entities from Groovy grammar
|
|
a7efae77
|
2014-05-24T21:03:41
|
|
#258 removed HTML entities from Groovy grammar
|
|
cddff711
|
2014-05-24T15:59:23
|
|
Simplify encoding logic
|
|
34365bfc
|
2014-05-24T15:57:07
|
|
Minified files
|
|
3ea7a8c4
|
2014-05-24T15:56:42
|
|
Merge pull request #262 from milesj/css-fixes
CSS function fixes
|
|
7b20bc1a
|
2014-05-24T12:55:05
|
|
Use lookahead for function matching
|
|
bae1210e
|
2014-05-24T12:33:50
|
|
Move function to base CSS [#237]
|
|
ee2c024e
|
2014-05-24T12:28:39
|
|
Make function matching a pattern [#239]
|
|
603a8a02
|
2014-05-24T15:26:54
|
|
Added twitter link to footer, minified some files
|
|
e437402f
|
2014-05-24T12:12:28
|
|
Remove entities [#258]
|
|
73313472
|
2014-05-24T14:31:35
|
|
Merge branch 'gh-pages' of https://github.com/LeaVerou/prism into gh-pages
|
|
d44312b6
|
2014-05-24T14:25:49
|
|
Converted the CSS, SCSS and JS grammars according to #258
|
|
8557daa9
|
2014-05-24T14:23:52
|
|
Remove leftover `console.log`
|
|
eb65c68b
|
2014-05-24T14:13:36
|
|
Generated minified versions & prism.js after merging #258
|
|
ad7513cb
|
2014-05-24T13:06:57
|
|
Attempt to fix clike and markup grammars
Original authors should at least verify these changes are correct
|
|
c0a0353d
|
2014-05-23T13:40:52
|
|
Stop prematurely escaping code block
Refactor Prism.highlight to HTML encode tokens before calling
Token.stringify.
This is a breaking change for nearly all grammars! Previously Prism was
encoding HTML entities *before* passing the code block to the parser.
Now it encodes HTML entities *after* the tokens have been parsed (before
rendering to HTML).
|
|
9f6cff9b
|
2014-05-23T13:01:26
|
|
Whitespace cleanup
|
|
97a87448
|
2014-05-22T17:38:54
|
|
Fixed #247
|
|
62561684
|
2014-05-22T17:36:51
|
|
Reversed change in Core
|
|
3084f7cd
|
2014-05-22T17:33:53
|
|
Merge branch 'gh-pages' of https://github.com/LeaVerou/prism into gh-pages
|
|
0bf2a8e5
|
2014-05-22T17:28:57
|
|
Updated minified files
|
|
8115e640
|
2014-05-17T21:32:55
|
|
add Scala support to prism
|
|
48cbb067
|
2014-04-25T11:54:39
|
|
support for PHP's #-style comments
although it fails to detect when a # is within a string, just like it does for // though when // isn't preceded by a :
but such are the limits of parsing code with regexp :(
|
|
d160f3c1
|
2014-04-22T22:14:13
|
|
Merge branch 'gh-pages' of https://github.com/LeaVerou/prism into gh-pages
|
|
8344fd5c
|
2014-04-21T13:37:18
|
|
Updated minified files
|
|
74a37abf
|
2014-04-21T13:36:40
|
|
Merge branch 'gh-pages' of https://github.com/LeaVerou/prism into gh-pages
|
|
36471491
|
2014-04-21T13:36:32
|
|
Updated minified files
|
|
1758634b
|
2014-04-21T06:29:13
|
|
Merge pull request #179 from geraintluff/gh-pages
Add Node.js support
|
|
00d50c01
|
2014-04-21T11:48:24
|
|
Fixed #236
|
|
64a48377
|
2014-04-11T13:55:50
|
|
Supports "dollar-slashy" string syntax introduced in Groovy 1.8. Also some fixes for compatibility with latest version of Prism.
|
|
b7c93c85
|
2014-04-11T05:34:47
|
|
Added new Groovy keyword – `trait` – to the language definition
|
|
1f6b1295
|
2014-04-02T01:20:23
|
|
Add `this` as a keyword in JavaScript
|
|
9fdcf0b3
|
2014-03-23T13:38:52
|
|
Added support for MySQL single line comment
Added an extra hash to support MySQL single line comments
|
|
e96c2b42
|
2014-03-21T13:29:24
|
|
Merge pull request #215 from idleberg/gh-pages
Added support for NSIS
|
|
6e3e5bab
|
2014-02-27T20:25:09
|
|
Added get/set to JS keywords
|
|
d1fa9596
|
2014-02-25T10:06:29
|
|
Update prism-nsis.min.js
|
|
da161cd7
|
2014-02-25T10:05:28
|
|
Update prism-nsis.js
|
|
a1918d6f
|
2014-02-25T10:04:16
|
|
Update prism-nsis.js
|
|
8270868f
|
2014-02-24T14:56:34
|
|
added credits
|
|
79f1a83a
|
2014-02-24T14:51:38
|
|
added NSIS syntax
|
|
b18fee53
|
2014-02-21T12:23:15
|
|
More token naming changes.
Check for loaded languages before attempting to augment/reference them.
|
|
e943e67f
|
2014-02-21T07:10:48
|
|
Improved token names
Optional quotes around runat="server". Group capturing doesn't seem to work in lookaheads, so mismatched quotes will pass :(
|
|
9f1d0e1e
|
2014-02-20T16:02:05
|
|
New language - ASP.NET (C#). Initial commit, still some work to do and hacks to workaround.
|
|
efff6cbc
|
2014-02-07T12:26:07
|
|
Updated prism-c.js for enhanced C macro support
Previously, #include <stdio.h> resulted in the < and > being tagged as operators, which is confusing. Also, preprocessor directives are not allowed to have spaces after the # and before the directive (#include, #define, #if, etc.), so I updated the regex to ignore improperly formatted macros. Currently, macro arguments will be highlighted as properties, but you can line 11 to whatever flagging is desired (keyword, for instance) to visually distinguish between the macro and its arguments.
|
|
a48fdb8f
|
2013-12-29T00:25:45
|
|
Remove duplicate keywords in PHP
There are some duplicate keyword in PHP keywords definition:
* extends
* static
* use
|
|
39e2eb58
|
2013-12-27T13:28:02
|
|
Removed extra character in variable regexp
Fix #175 by removing '&' as a variable prefix. For some reason, this
change also fixes the '<' character being appended with a ;
character.
|
|
7bfed0f0
|
2013-12-18T22:31:53
|
|
added extra methods to HTTP lang
|
|
a74ff878
|
2013-12-14T19:36:16
|
|
Allow more characters in attribute values
The current pattern uses `\w+` but the [html5 grammar](http://www.w3.org/html/wg/drafts/html/master/syntax.html#attribute-value-(unquoted%29-state) allows just about any character, `[^\s'">=]+`
|
|
def5c233
|
2013-12-01T15:16:53
|
|
add Go support to prism
|
|
8a7157be
|
2013-11-12T22:33:44
|
|
Add Node.js support
|
|
32286a6d
|
2013-10-29T13:35:38
|
|
add .min version for csharp and gherkin. also fixed indentation for csharp
|
|
837f61be
|
2013-10-27T10:51:02
|
|
add missing keywords to csharp language component
|
|
e694d6a1
|
2013-10-26T20:56:49
|
|
add component file for gherkin language
|
|
e6308d47
|
2013-10-26T20:03:46
|
|
add component file for csharp
|