-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR fixes that JSON did not support [JSONP](https://en.wikipedia.org/wiki/JSONP) callback functions. I also added a JSON example page.
- Loading branch information
1 parent
5bd182c
commit b5041cf
Showing
12 changed files
with
78 additions
and
15 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,5 +17,3 @@ Prism.languages.json = { | |
alias: 'keyword' | ||
} | ||
}; | ||
|
||
Prism.languages.jsonp = Prism.languages.json; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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*\()/ | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<h2>Full example</h2> | ||
<pre><code>{ | ||
"data": { | ||
"labels": [ | ||
"foo", | ||
"bar" | ||
], | ||
"series": [ | ||
[ 0, 1, 2, 3 ], | ||
[ 0, -4, -8, -12 ] | ||
] | ||
}, | ||
// we even support comments | ||
"error": null, | ||
"status": "Ok" | ||
}</code></pre> | ||
|
||
<h2>JSONP</h2> | ||
<pre><code>callback({ "data": null });</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
callback(); | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["function", "callback"], | ||
["punctuation", "("], | ||
["punctuation", ")"], | ||
["punctuation", ";"] | ||
] | ||
---------------------------------------------------- | ||
|
||
Checks for callback functions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{} | ||
{ } | ||
[] | ||
], | ||
}, | ||
, | ||
; | ||
() | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["punctuation", "{"], ["punctuation", "}"], | ||
["punctuation", "{"], ["punctuation", "}"], | ||
["punctuation", "["], ["punctuation", "]"], | ||
["punctuation", "]"], ["punctuation", ","], | ||
["punctuation", "}"], ["punctuation", ","], | ||
["punctuation", ","], | ||
["punctuation", ";"], | ||
["punctuation", "("], ["punctuation", ")"] | ||
] | ||
---------------------------------------------------- | ||
|
||
Checks for punctuation. |