|
12c0b20a
|
2018-03-08T22:19:01
|
|
Decouple minus sign from number pattern in most languages. Close #1110
|
|
b98e5b9b
|
2018-03-07T20:53:45
|
|
C-like: Change order of comment patterns and make multi-line one greedy. Fix #1337
|
|
e0cd47f8
|
2018-03-03T20:13:59
|
|
Core: Don't thow an error if lookbehing is used without anything matching.
|
|
69f2e2cb
|
2017-12-06T04:10:50
|
|
Allow any element being root instead of document. (#1230)
(better compatibility than #397)
|
|
7dc1e453
|
2017-12-05T08:58:11
|
|
CSS and JS: Make CSS and JS inclusions in Markup greedy. Fix #1240
|
|
de6de454
|
2017-11-21T09:20:11
|
|
Optimize more Unicode regexes (#1229)
In previous commit, #1227, a “function” regex JavaScript definition was updated. The same regex is used in few more points, and this PR optimizes them too.
Tests are ran and passed.
|
|
f234ea40
|
2017-11-20T23:34:38
|
|
Unicode characters in CSS properties (#1227)
* Unicode characters in CSS properties
Highlight Unicode characters in CSS properties correctly, for example “.foo { --bär: 3 }”.
Optimized the “function” regex in the JavaScript definition: replaced “_a-zA-Z0-9” with “\w”, removed uppercase “A-Z” because the “i” flag is set.
Used that regex for CSS but removed “$” and added “-”.
* Add a test
* Add minified versions
* Update prism.js
* Revert "Update prism.js"
This reverts commit 241464ba1ba5e350b8483d926e73364f9e9d99c4.
* Update prism.js too
|
|
d09982d8
|
2017-11-05T14:24:19
|
|
Core: Provide a way to load Prism from inside a Worker without listening to messages. (#1188)
Using disableWorkerMessageHandler config.
|
|
c33be19a
|
2017-11-05T13:32:00
|
|
Core: Prevent error from throwing when element does not have a parentNode in highlightElement. Fix #1203
|
|
ea380c6c
|
2017-10-22T15:00:54
|
|
Markup: Regexp optimisation + fix punctuation inside attr-value
|
|
93d4002c
|
2017-10-22T14:46:33
|
|
JavaScript: Regexp optimisation + don't use captures if not needed
|
|
438926c3
|
2017-10-22T14:28:13
|
|
CSS: Regexp simplification + don't use captures if not needed + handle multi-line style attributes
|
|
5895978f
|
2017-10-22T14:21:31
|
|
C-like: Regexp simplification + don't use captures if not needed
|
|
de996d7d
|
2017-10-21T10:17:56
|
|
Merge branch 'remove_spellcheck_attribute' of https://github.com/emmanuelgautier/prism into emmanuelgautier-remove_spellcheck_attribute
# Conflicts:
# components/prism-core.min.js
|
|
8ee2cd38
|
2017-10-10T08:35:13
|
|
JavaScript: Better highlighting of functions (#1190)
|
|
25788eb5
|
2017-09-09T12:05:55
|
|
Merge branch 'RemoveIE8' of https://github.com/zeitgeist87/prism into zeitgeist87-RemoveIE8
# Conflicts:
# components/prism-core.js
# components/prism-core.min.js
# plugins/line-highlight/prism-line-highlight.js
# plugins/line-highlight/prism-line-highlight.min.js
# prism.js
|
|
3426ed16
|
2017-09-09T11:47:23
|
|
C-like: Add support for unclosed block comments. Close #828
|
|
ac09e975
|
2017-07-11T08:13:50
|
|
JavaScript: Reduced backtracking in regex pattern. Fix #1159
|
|
16ce4b33
|
2017-07-05T19:55:44
|
|
Run gulp
|
|
e13fdfa4
|
2017-02-08T17:19:22
|
|
Add minor optimizations for the greedy flag
|
|
1736f4aa
|
2017-02-08T01:36:27
|
|
Fix corner cases for the greedy flag
By refactoring the tokenize() method into two separate methods, it is
possible to recursively clean up any broken tokens left by the greedy
feature.
This should fix the issue 1075.
|
|
65cbaa95
|
2017-05-08T13:27:57
|
|
Run gulp after #1107
|
|
9f649fbe
|
2017-05-08T12:05:35
|
|
JavaScript: Properly match every operator as a whole token. Fix #1133
|
|
70cb4729
|
2017-05-08T11:44:21
|
|
Run before-highlight and after-highlight hooks even when no grammar is found. Fix #1134
|
|
01e74afa
|
2017-02-28T12:42:27
|
|
remove comments spellcheck for amp validation
|
|
7192ffef
|
2017-01-28T09:57:30
|
|
Run gulp
|
|
b8ce1e7c
|
2016-12-03T11:52:48
|
|
Merge branch 'gh-pages' of https://github.com/PrismJS/prism into gh-pages
# Conflicts:
# components/prism-core.min.js
|
|
83bafbd4
|
2016-12-03T11:46:26
|
|
env.code can be modified by before-sanity-check hook even when using language-none. Fix #1066
|
|
17e33bc0
|
2016-11-20T12:52:54
|
|
Reduce risk of XSS (#1051)
* Skip non-own properties of env.attributes
Use `Object.keys` instead of a for-in loop to find optional attributes.
The former only grabs keys that are own properties, the latter also
includes inherit properties from `Object.prototype`.
This reduces the risk of XSS if an attacker somehow manages to
manipulate the prototype chain of the Object prototype.
* Fix root cause of XSS in autolinker plugin #1054
* command-line plugin: Safely encode attributes
If an attacker has control over the values of the attributes
"data-prompt", "data-user", or "data-host", then XSS was possible.
This fixes the issue, by encoding quotes as the `"` entity.
* show-language plugin: innerHTML -> textContent
There is no need for `innerHTML` here. At best nothing happens,
at worst XSS is possible (though the odds are negligible since
the attacker would have to control the detected language).
* toolbar plugin: innerHTML -> textContent
|
|
32cd99ff
|
2016-10-24T21:21:37
|
|
Fix greedy-flag bug
This bug occurs in the relatively rare case of a pattern matching the
empty string. It was reported in issue #1039. If for example a HTML
page contains an empty script tag `<script></script>` then the script
pattern will match anything inside, which is the empty string.
This empty string is then passed to the constructor of the Token class.
Since `""` is falsy in Javascript the property `matchedStr` is set to
`null`.
But the property `matchedStr` is needed to calculate the current
position for the greedy feature. A `null` value in `matchedStr` results
in a `pos` that is `NaN`. This causes the bug described in issue #1039.
Since the property `matchedStr` is only ever needed to calculate the
length of the Token, it is more efficient to store the length directly
instead of the string. As a side effect this also fixes issue #1039.
|
|
f138f8f1
|
2016-09-01T23:40:14
|
|
Run gulp
|
|
e57e26d5
|
2016-08-17T15:56:41
|
|
Makes CSS strings greedy. Fix #1013
|
|
cda106f9
|
2016-08-15T02:45:50
|
|
update min file and reverse core
|
|
e9355cc4
|
2016-08-15T02:43:09
|
|
add prefix feature for custom class plugin
|
|
3dc8c9e1
|
2016-07-11T20:36:16
|
|
Don't insert space before ">" when there is no attributes
|
|
31ea66b6
|
2016-07-04T00:32:28
|
|
Allow for dots in Markup tag names, but not in HTML tags included in Textile. Fixes #888
|
|
3780571b
|
2016-07-03T11:59:59
|
|
Remove IE8 plugin
|
|
c9bdcd35
|
2016-07-03T02:37:29
|
|
Manual merge of #988. Closes #988, fixes #987.
|
|
8de64b6b
|
2016-07-03T02:32:02
|
|
Run gulp
|
|
9893489c
|
2016-06-18T14:18:27
|
|
Replace flags property of RegExp with a more compatible alternative
|
|
d80900cc
|
2016-06-04T19:52:38
|
|
Improvement to greedy-flag
This patch expands the idea of the greedy flag and significantly
improves it, by matching against the whole text instead of just
the next couple of tokens. This does not only improve the
results, but it should also slightly improve performance.
|
|
1158e460
|
2016-06-03T11:34:01
|
|
Rearrange the `string` and `template-string` token in JavaScript
It is more likely that single and double quotes appear in
a template string, than backticks in a normal string. Fixes issue
#963.
|
|
f130680c
|
2016-05-29T11:15:59
|
|
Use requestAnimationFrame instead of setTimeout
|
|
4eb7ee45
|
2016-05-26T11:27:03
|
|
Allow for asynchronous loading of prism.js
|
|
acd9508f
|
2016-05-17T14:23:02
|
|
Use toLowerCase on language names
|
|
21dd0d14
|
2016-02-15T23:08:24
|
|
Use a HTML-comment to escape code
|
|
49cf8991
|
2016-03-08T15:03:59
|
|
Fix minor bug with new greedy-feature
This fixes a minor bug that causes invalid highlighting in some
edge cases, where two greedy patterns overlap each other.
|
|
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.
|
|
90432f96
|
2016-02-18T01:22:40
|
|
Add comments to better document the greedy-pattern feature
|
|
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>
|
|
54400fba
|
2016-02-17T15:26:01
|
|
Add property 'aliasTitles' to components.js
This is necessary, because a language that has a lot of aliases
like markup (HTML, SVG, XML, MathML), is only added to the
languageMap once as "Markup". So any plugin that depends on the
languageMap is limited by that.
This patch allows the definition of additional titles for
languages, depending on the alias that is used.
|
|
af8da8ec
|
2016-02-14T21:08:14
|
|
Implemented @zeitgeist87’s suggestion in #890 re: env.elements
|
|
ab65be27
|
2016-02-12T21:32:19
|
|
Fix catastrophic backtracking regex issues
|
|
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
|
|
3656a085
|
2015-12-30T13:28:00
|
|
Remove unnecessary check for the existence of the addEventListener
method
All target browsers for Prism support this method now. The check
is therefore obsolete.
|
|
a912063c
|
2015-12-30T00:56:38
|
|
Update auto-generated files and minified versions
|
|
97d0f49a
|
2015-12-26T09:50:23
|
|
Update auto-generated files
|
|
2ba763e0
|
2015-10-13T21:08:49
|
|
Add support for Parser
|
|
e135947c
|
2015-10-10T12:48:04
|
|
Run gulp and update tests after #801 merge
|
|
29643f4e
|
2015-10-06T08:48:21
|
|
Simplify patterns for <style> and <script> tags
|
|
0e93b417
|
2015-09-24T09:16:57
|
|
Fix code indentation style
|
|
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>
|
|
792e35cf
|
2015-09-16T22:38:15
|
|
C-like: optimized string regexp
|
|
283691ec
|
2015-09-06T11:17:35
|
|
Markup: don't allow dot inside tag name
|
|
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
|
|
071c3ddf
|
2015-09-04T00:13:37
|
|
Merge branch 'c-fixes' of https://github.com/rygorous/prism into gh-pages
Conflicts:
components/prism-c.js
components/prism-c.min.js
components/prism-clike.js
components/prism-clike.min.js
+ added tests
|
|
2f9fe1ef
|
2015-09-03T23:39:16
|
|
Added some language aliases.
|
|
29e26dc3
|
2015-09-03T23:14:19
|
|
JavaScript: Allow for all non-ASCII characters in function names. Fix #400
|
|
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
|
|
85d8a556
|
2015-08-31T20:55:52
|
|
Markup: Don't allow = to appear in tag name
|
|
135ee9d1
|
2015-08-22T23:39:15
|
|
C-like: Improved operator regex + add != and !==
|
|
aa757f6c
|
2015-08-21T19:05:38
|
|
C-like: add word boundary before class-name prefixes
|
|
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
|
|
1c630b1d
|
2015-08-09T00:05:14
|
|
complete hook added
|
|
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.
|
|
d4194c93
|
2015-07-11T18:56:55
|
|
C-like: use look-ahead instead of inside to match functions
|
|
b6535ddb
|
2015-07-10T08:07:05
|
|
C-like: removed unused 'ignore' pattern.
|
|
15760e18
|
2015-07-08T20:23:32
|
|
C-like and CSS: Fixes for \r\n
|
|
f2e2718f
|
2015-07-08T19:39:35
|
|
CSS: Selector regexp should not include last spaces before brace
|
|
901812c1
|
2015-07-08T19:35:57
|
|
CSS: Improved url and string regexps + handle \r
|
|
e2540889
|
2015-07-08T19:32:10
|
|
CSS: Improve atrules
|
|
cd0273ee
|
2015-07-08T19:26:35
|
|
CSS: Highlight parentheses as punctuation
|
|
c19a238b
|
2015-07-08T19:18:35
|
|
Markup: doctype and prolog can be multi-line.
|
|
1ebcb8e6
|
2015-07-08T19:17:36
|
|
Markup: highlight single quotes in attr-value as punctuation
|
|
8be7815b
|
2015-07-01T18:50:02
|
|
Run gulp task
|
|
670d5afe
|
2015-06-28T02:33:28
|
|
Regression fix: do not allow multi-line strings in C-like (unless properly escaped)
|
|
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
|
|
a7064dd4
|
2015-06-20T20:07:37
|
|
Moved up JS strings before template strings as they are far more common
|
|
476cbf42
|
2015-06-20T20:06:39
|
|
Improved regex performance of C-like strings and JS regexps
|
|
a8aa0588
|
2015-06-14T18:18:37
|
|
Implemented support for octal and binary numbers in javascript
They are supported from ES6+
|
|
04f72b14
|
2015-06-14T18:26:16
|
|
ES6: Template strings + interpolation
|
|
1453aac5
|
2015-06-14T17:53:53
|
|
Run gulp task
|
|
75452ba1
|
2015-06-12T21:35:06
|
|
Markup: optimized tag's regexp so that it stops crashing on large unclosed tags
|