extending.html


Log

Author Commit Date CI Message
Golmote eba02358 2018-03-04T16:24:32 Docs: Add note on `async` parameter to clarify the requirement of using a single bundled file. Closes #1249
Golmote 6e50d440 2017-12-05T20:17:39 Core: Update API doc to document `Prism.highlightAllUnder()`
Andreas Rohner 2746d7f3 2016-04-30T09:48:39 Document the newly added greedy-flag
Andreas Rohner 5b78124e 2016-04-30T09:48:11 Fix whitespace in extending.html
Lea Verou 80aedb2a 2015-08-26T14:49:26 Updated documentation since the example was not relevant any more
Andreas Rohner 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' }
Andreas Rohner 43e4e693 2014-08-10T23:26:10 Allow multiple regex per token name by using arrays In most languages there are multiple different ways of declaring the same constructs (e.g. comments, strings, ...) and sometimes it is difficult or unpractical to match all of them with one single regular expression. This patch adds the possibility to use an array of pattern objects. 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 }, { pattern: /(^|[^\\:])\/\/.*?(\r?\n|$)/g, lookbehind: true } ],
Andreas Rohner 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 },
Lea Verou 87d7640e 2013-10-07T09:46:33 Moved themes to themes/ folder
Dido Arellano 2ca412e4 2013-09-09T22:07:55 Use Prism.languages.markup as grammar examples Prism.languages.html doesn't exist. The grammar for HTML is Prism.languages.markup.
Lea Verou 97d57c65 2013-05-19T00:35:29 Split the components registration object into its own file
Lea Verou 9863ad72 2012-07-31T18:44:17 Added Google Analytics
Lea Verou 571ca0a5 2012-07-31T18:39:29 Added favicon
Lea Verou 9ed86b86 2012-07-31T18:14:55 Styling and docs changes
Lea Verou e95a85c0 2012-07-31T16:17:53 Merged the comment and line-comment tokens
Lea Verou b2505655 2012-07-29T00:35:02 Docs update, minor styling changes
Lea Verou 54e2eeab 2012-07-29T00:26:50 Added (and documented) Prism.languages.insertBefore
Lea Verou bd4e8d15 2012-07-23T18:54:30 ALL THE THINGS! Most notably: Simple templating, API changes, show invisibles plugin, download (build) page