mirror of
https://github.com/neocities/neocities.git
synced 2025-05-13 07:57:16 +02:00
start on the coding assistant
This commit is contained in:
parent
8f6a85d81d
commit
8ba6005c67
546 changed files with 54575 additions and 12 deletions
61
public/js/highlight/es/languages/json.js
Normal file
61
public/js/highlight/es/languages/json.js
Normal file
|
@ -0,0 +1,61 @@
|
|||
/*! `json` grammar compiled for Highlight.js 11.9.0 */
|
||||
var hljsGrammar = (function () {
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
Language: JSON
|
||||
Description: JSON (JavaScript Object Notation) is a lightweight data-interchange format.
|
||||
Author: Ivan Sagalaev <maniac@softwaremaniacs.org>
|
||||
Website: http://www.json.org
|
||||
Category: common, protocols, web
|
||||
*/
|
||||
|
||||
function json(hljs) {
|
||||
const ATTRIBUTE = {
|
||||
className: 'attr',
|
||||
begin: /"(\\.|[^\\"\r\n])*"(?=\s*:)/,
|
||||
relevance: 1.01
|
||||
};
|
||||
const PUNCTUATION = {
|
||||
match: /[{}[\],:]/,
|
||||
className: "punctuation",
|
||||
relevance: 0
|
||||
};
|
||||
const LITERALS = [
|
||||
"true",
|
||||
"false",
|
||||
"null"
|
||||
];
|
||||
// NOTE: normally we would rely on `keywords` for this but using a mode here allows us
|
||||
// - to use the very tight `illegal: \S` rule later to flag any other character
|
||||
// - as illegal indicating that despite looking like JSON we do not truly have
|
||||
// - JSON and thus improve false-positively greatly since JSON will try and claim
|
||||
// - all sorts of JSON looking stuff
|
||||
const LITERALS_MODE = {
|
||||
scope: "literal",
|
||||
beginKeywords: LITERALS.join(" "),
|
||||
};
|
||||
|
||||
return {
|
||||
name: 'JSON',
|
||||
keywords:{
|
||||
literal: LITERALS,
|
||||
},
|
||||
contains: [
|
||||
ATTRIBUTE,
|
||||
PUNCTUATION,
|
||||
hljs.QUOTE_STRING_MODE,
|
||||
LITERALS_MODE,
|
||||
hljs.C_NUMBER_MODE,
|
||||
hljs.C_LINE_COMMENT_MODE,
|
||||
hljs.C_BLOCK_COMMENT_MODE
|
||||
],
|
||||
illegal: '\\S'
|
||||
};
|
||||
}
|
||||
|
||||
return json;
|
||||
|
||||
})();
|
||||
;
|
||||
export default hljsGrammar;
|
Loading…
Add table
Add a link
Reference in a new issue