Commit Graph

36 Commits

Author SHA1 Message Date
Michael Schmidt 333bd590bd
More documentation for language definitons (#3427) 2022-04-17 14:05:54 +02:00
Wei Ting 3755120096
Document standard tokens and provide examples (#3104) 2021-10-21 19:46:08 +02:00
Michael Schmidt de79636a8a
Website: Moved remaining vendor files into `vendor` folder (#2829) 2021-05-01 14:57:39 +02:00
Michael Schmidt 8e1f38ff44
Website: Updated and improved guide on "Extending Prism" page (#2586) 2020-11-04 11:44:43 +01:00
Anders D. Johnson dfa5498a0b
Website: Fixed typos "Prims" (#2455) 2020-07-03 19:40:39 +02:00
Michael Schmidt 91fdd0b192
Website: New assets directory for all web-only files (#2180) 2020-06-28 01:58:55 +02:00
Michael Schmidt 4ff555bea1
Added JSDoc (#1782) 2020-06-28 01:34:29 +02:00
Michael Schmidt ff74a61063
Added `npm run build` command (#2356) 2020-06-12 18:42:12 +02:00
Michael Schmidt ce0fa227a7
Website improvements (#2053) 2020-05-07 13:40:37 +02:00
Michael Schmidt 59068d67bd
Added documentation for new dependency API (#2141) 2020-01-05 20:03:41 +01:00
Jakub Klímek 7cb65eeca5 Fixed alias example in extending page (#2011)
This fixes the example on how to add a language alias to a language definition.
2019-08-05 13:16:32 +02:00
Michael Schmidt 24c8e71754 Extending page: Fixed typo + new alias section (#1949) 2019-06-29 18:11:14 -04:00
Michael Schmidt ddf8123369
Docs: Added "Creating a new language definition" section (#1925)
This adds a new "Creating a new language definition" section explaining the workflow of creating a new lang. def..
2019-06-01 17:05:27 +02:00
Michael Schmidt 439ea1ee9a
Added scripts directory (#1781)
This adds a new `scripts` directory for all scripts used exclusively by the prismjs.com website.
2019-03-11 00:32:45 +01:00
Michael Schmidt 18f2921d9c
Docs: Added missing parameter (#1774)
This adds a missing parameter to the `Prism.highlight` documentation.
2019-03-10 21:40:02 +01:00
Michael Schmidt 74916d48bd Fixed empty link in extending (#1507) 2018-08-19 10:54:25 -04:00
Valtteri Laitinen d95f8fb48e Use rel="icon" instead of rel="shortcut icon" (#1398) 2018-04-22 14:55:38 +02:00
Valtteri Laitinen 95146c8fc4 Use HTTPS / canonical URLs (#1390)
Also, remove the broken link in `/index.html`.
2018-04-17 00:28:42 +02:00
Golmote eba02358b2 Docs: Add note on `async` parameter to clarify the requirement of using a single bundled file. Closes #1249 2018-03-04 16:24:32 +01:00
Golmote 6e50d440ed Core: Update API doc to document `Prism.highlightAllUnder()` 2017-12-05 20:17:39 +01:00
Andreas Rohner 2746d7f301 Document the newly added greedy-flag 2016-04-30 09:48:39 +02:00
Andreas Rohner 5b78124e3f Fix whitespace in extending.html 2016-04-30 09:48:11 +02:00
Lea Verou 80aedb2aea Updated documentation since the example was not relevant any more 2015-08-26 14:49:26 +02:00
Andreas Rohner 3309890f9f 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'
}
2014-08-25 23:50:02 +02:00
Andreas Rohner 43e4e6935f 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
    }
],
2014-08-12 11:26:53 +02:00
Andreas Rohner fef8cd498f 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
},
2014-08-10 20:21:53 +02:00
Lea Verou 87d7640e0b Moved themes to themes/ folder 2013-10-07 09:46:33 +02:00
Dido Arellano 2ca412e41a Use Prism.languages.markup as grammar examples
Prism.languages.html doesn't exist. The grammar for HTML is
Prism.languages.markup.
2013-09-09 22:07:55 +08:00
Lea Verou 97d57c65d4 Split the components registration object into its own file 2013-05-19 00:35:29 +03:00
Lea Verou 9863ad7263 Added Google Analytics 2012-07-31 18:44:17 +12:00
Lea Verou 571ca0a55f Added favicon 2012-07-31 18:39:29 +12:00
Lea Verou 9ed86b866f Styling and docs changes 2012-07-31 18:14:55 +12:00
Lea Verou e95a85c02e Merged the comment and line-comment tokens 2012-07-31 16:22:11 +12:00
Lea Verou b2505655c8 Docs update, minor styling changes 2012-07-29 00:35:02 -07:00
Lea Verou 54e2eeab09 Added (and documented) Prism.languages.insertBefore 2012-07-29 00:26:50 -07:00
Lea Verou bd4e8d158b ALL THE THINGS! Most notably: Simple templating, API changes, show invisibles plugin, download (build) page 2012-07-23 18:54:30 -07:00