Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
feat(prism): Add prism‑jsonp
Browse files Browse the repository at this point in the history
This adds the `prism‑jsonp` language definition, which provides
syntax highlighting for JSON with Padding.

This avoids regressing instances of `<pre class="brush: jsonp;">`,
which are currently supported on MDN.

# External links:
- https://en.wikipedia.org/wiki/JSONP
  • Loading branch information
ExE-Boss committed Mar 25, 2019
1 parent 952af05 commit 6704c51
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"bower_components/prism/components/prism-clike.js",
"bower_components/prism/components/prism-javascript.js",
"bower_components/prism/components/prism-json.js",
"bower_components/prism/components/prism-jsonp.js",
"bower_components/prism/components/prism-css-extras.js",
"bower_components/prism/components/prism-rust.js",
"bower_components/prism/plugins/line-highlight/prism-line-highlight.js",
Expand Down
1 change: 1 addition & 0 deletions kuma/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,7 @@ def pipeline_one_scss(slug, **kwargs):
"js/libs/prism/prism-clike.js",
"js/libs/prism/prism-javascript.js",
"js/libs/prism/prism-json.js",
"js/libs/prism/prism-jsonp.js",
"js/libs/prism/prism-css-extras.js",
"js/libs/prism/prism-rust.js",
"js/libs/prism/prism-line-highlight.js",
Expand Down
7 changes: 7 additions & 0 deletions kuma/static/js/libs/prism/prism-jsonp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Prism.languages.jsonp = Prism.languages.extend('json', {
'punctuation': /[{}[\]();,.]/
});

Prism.languages.insertBefore('jsonp', 'punctuation', {
'function': /[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/
});

0 comments on commit 6704c51

Please sign in to comment.