|
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
},
|
|
4247baec
|
2014-07-28T16:54:50
|
|
Fix conflicts.
|
|
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
|
|
7cfd29a9
|
2014-05-26T11:20:55
|
|
Rebuild minified files.
|
|
4a472307
|
2014-05-24T16:14:20
|
|
Minified files
|
|
603a8a02
|
2014-05-24T15:26:54
|
|
Added twitter link to footer, minified some files
|
|
eb65c68b
|
2014-05-24T14:13:36
|
|
Generated minified versions & prism.js after merging #258
|
|
62561684
|
2014-05-22T17:36:51
|
|
Reversed change in Core
|
|
0bf2a8e5
|
2014-05-22T17:28:57
|
|
Updated minified files
|
|
8344fd5c
|
2014-04-21T13:37:18
|
|
Updated minified files
|
|
1d899d7d
|
2013-06-14T11:46:34
|
|
Fixed parsing for entities and <> chars
|
|
29b28801
|
2013-05-21T16:01:30
|
|
Added 'before-insert' hook. After when code is highlighted and before being inserted to document.
|
|
c82d6df0
|
2013-05-18T17:31:20
|
|
Added min files
|
|
801aab58
|
2013-05-11T04:37:44
|
|
Added parent access to wrap hook
|
|
c3a69913
|
2013-05-09T21:01:17
|
|
Added language id to wrap hook
|
|
358fbbd6
|
2013-01-27T03:50:38
|
|
Replaced iteration with Array#map
|
|
1b40db97
|
2012-11-10T00:23:33
|
|
Made Java & JavaScript inherit from a generic C-style language definition; Added methods for language definition inheritance; Added simple dependency management in downloader
|
|
54fdc1f4
|
2012-09-13T20:06:11
|
|
Removed pointless trim()
|
|
ddd1eb89
|
2012-08-01T12:02:46
|
|
Applied #15 to prism-core.js
|
|
c75bbc24
|
2012-07-31T19:08:31
|
|
Fixed bug with classnames
|
|
ec8fb796
|
2012-07-31T17:47:56
|
|
Added helper method Prism.languages.DFS
|
|
54e2eeab
|
2012-07-29T00:26:50
|
|
Added (and documented) Prism.languages.insertBefore
|
|
4da6cfcd
|
2012-07-27T00:08:10
|
|
Removed useless code
|
|
6763cd53
|
2012-07-26T18:48:34
|
|
Fixed bug where block code wasn’t styled properly
|
|
9ea52e2a
|
2012-07-26T18:41:49
|
|
Removed IE8 support
|
|
cfaf681d
|
2012-07-26T18:17:55
|
|
Removed the need for .prism
|
|
1b5ab23a
|
2012-07-23T19:32:27
|
|
Added setting to turn automatic highlighting off and to set a default language
|
|
bd4e8d15
|
2012-07-23T18:54:30
|
|
ALL THE THINGS! Most notably: Simple templating, API changes, show invisibles plugin, download (build) page
|
|
a4b9b918
|
2012-07-18T15:57:08
|
|
Added minified versions
|