|
c88036ca
|
2016-02-19T22:27:22
|
|
Add tests for new greedy-pattern feature and fix bug in Kotlin
This patch adds tests for the new greedy-pattern feature and fixes
a small bug in the Kotlin language, that resulted from that.
It also cleans up some of the comments and refactors a few lines
in the tokenloop.
|
|
2705c509
|
2015-09-24T19:36:10
|
|
Partial solution for the "Comment-like substrings"-problem
This patch introduces a new attribute called `greedy`. The
attribute is a simple boolean flag. If there is no match
for a greedy pattern it can concatenate the next two tokens
into a single string and try to match on this string again.
If a match is found on the second attempt, then the old tokens are
deleted and replaced by the new match.
This solves the "Comment-like substrings"-problem for exactly one
comment at very little cost. With this patch the following code is
highlighted correctly:
"foo /* bar */ baz"; "foo // bar";
/lala"test"sdf/;
This approach fails if there are more than one comments inside the
string:
"foo /* bar */ baz /* bar */ baz";
Signed-off-by: Andreas Rohner <andreas.rohner@gmx.net>
|
|
af8da8ec
|
2016-02-14T21:08:14
|
|
Implemented @zeitgeist87’s suggestion in #890 re: env.elements
|
|
b86c727a
|
2016-02-03T15:25:26
|
|
Fix DFS bug
The DFS function uses an object as a key into another object. This
doesn't work, because the key gets stringified to "[object
Object]" and is therefore useless.
|
|
0e87ff0a
|
2016-01-27T11:55:16
|
|
Add solarized light theme to the list of themes and update
auto-generated files generated by gulp.
|
|
7fab7a2d
|
2016-01-26T23:16:06
|
|
Reverse merge of last PR and remove the 'data-selector' attribute.
|
|
77c6ea17
|
2016-01-26T02:33:20
|
|
Allow users to use their own element selector
Add the parameter 'data-selector' to the script tag, to
allow users to set the selector used to query for code elements.
|
|
1eb9a5fb
|
2016-01-17T13:56:32
|
|
Update auto-generated files
|
|
97d0f49a
|
2015-12-26T09:50:23
|
|
Update auto-generated files
|
|
09be99e7
|
2015-09-23T20:34:29
|
|
Improve performance by doing more work in the worker
Currently the worker tokenizes the code and then turns it into a
JSON string. This JSON string is sent back to the main thread as a
message and parsed. Then it is turned into a HTML string and
stored in the attribute env.highlightedCode.
These conversions into JSON are unnecessary, because we can create
the HTML string directly in the worker and send it as a message to
the main thread.
Signed-off-by: Andreas Rohner <andreas.rohner@gmx.net>
|
|
b2f14d96
|
2015-09-04T08:19:21
|
|
Merge branch 'plugin-jsonp' of https://github.com/nauzilus/prism into gh-pages
Conflicts:
components/prism-core.min.js
|
|
e42a2289
|
2015-09-03T22:47:50
|
|
Explicitly make the Worker close itself after highlighting, so that users have control on this behaviour when directly using Prism inside a Worker. Fix #492
|
|
0356c58c
|
2015-09-03T19:09:48
|
|
Apply changes from #754 to all plugins so that none of them throw errors in node.
Autolinker, Show invisibles and WPD can now be used with node.
Removed unused minified CSS file.
Also added missing space between attributes during wrapping.
|
|
c8f83b20
|
2015-09-03T18:43:33
|
|
Run gulp task
|
|
ed9f2b21
|
2015-08-17T08:47:32
|
|
Move removal of initial line feed to a plugin
|
|
fd549959
|
2015-08-13T08:33:48
|
|
Fix complete hook behaviour + run gulp task
|
|
5f133c80
|
2015-07-16T21:09:40
|
|
Fixed prism-core and prism-file-highlight to prevent errors in IE8.
Used local variable _self instead of overwriting self.
Closes #468.
|
|
8030db91
|
2015-06-25T08:00:14
|
|
File Highlight: allow to specify the language (takes precedence over extension guess) + Set language on parent even if unknown. Fix #607
|
|
1eb49594
|
2015-02-18T21:52:53
|
|
Make use of method `_.util.type`.
|
|
c711660a
|
2015-01-15T09:00:47
|
|
Deep clone arrays
|
|
703d47e6
|
2015-01-11T23:18:41
|
|
Simplified regexp for trailing line feeds
|
|
36999ddf
|
2015-01-08T19:51:55
|
|
Handle trailing \r\n and \r
|
|
2d5089ed
|
2015-01-08T08:55:24
|
|
Remove leading line break
Fixes #455
|
|
86b4d4df
|
2014-12-20T14:21:28
|
|
Run gulp tasks
|
|
17d9aa8a
|
2014-11-14T20:30:10
|
|
insertBefore() with only two arguments appends (similar to how DOM insertBefore() behaves)
|
|
436a7bd6
|
2014-11-14T19:43:50
|
|
Make insertBefore() update pointers to the object from other language definitions.
Use case/Example: In dabblet, code-highlight.js adds some extra tokens to CSS. But CSS also extends markup to highlight CSS in style elements/attributes and that happens *before* the extra CSS tokens were added. However, because references were not updated, CSS highlighted in markup was using the original CSS definition, without the added tokens. I’m surprised we haven’t caught this earlier, I’d expect it to affect many advanced uses of Prism.
|
|
4b9e11c6
|
2014-11-14T19:19:31
|
|
CSS highlighting in HTML style attribute
|
|
08037e5b
|
2014-09-05T11:01:02
|
|
Fix for DFS bug with new pattern array feature
This patch implements support for the new pattern array feature in the
Prism.languages.DFS function and fixes a bug in the autolinker plugin.
It adds an optional parameter to the callback of Prism.languages.DFS,
which contains the type of the current object as oposed to the key in
the parent. In most cases both key and type are exactly the same. Only
if the parent is an array the key will contain the index number and the
type will contain the attribute name of the array in the parent object.
The key can be used to replace the object in the parent and the type can
be used to provide the necessary context.
|
|
3309890f
|
2014-08-12T13:48:47
|
|
Add option to define aliases for tokens
This patch adds an option called `alias`, which allows the
definition of additional CSS classes for token names. This can be
useful, to combine the styling of a well known token, which is already
supported by most of the themes, with a semantically correct token name.
The option can be set to a string literal or an array of string
literals. In the following example the token name `latex-equation` is
not supported by any theme, but it will be highlighted the same as a
string.
'latex-equation': {
pattern: /\$(\\?.)*?\$/g,
alias: 'string'
}
|
|
b1cc49d8
|
2014-08-23T20:02:02
|
|
Update minified and auto generated files
|
|
89bddb84
|
2014-08-12T11:27:26
|
|
Add automatically generated files
|
|
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
|