@readme/syntax-highlighter 10.11.1 → 10.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +80 -0
- package/CODE_OF_CONDUCT.md +128 -0
- package/README.md +1 -0
- package/SECURITY.md +12 -0
- package/dist/index.js +1 -1
- package/dist/index.node.js +1 -1
- package/lib/enzyme.js +2 -1
- package/package.json +26 -25
- package/public/index.js +1 -42
- package/src/utils/canonical.js +2 -0
- package/src/utils/cm-mode-imports.js +2 -0
- package/src/utils/modes.js +4 -0
- package/src/utils/uppercase.js +3 -0
- package/webpack.config.dev.js +1 -2
- package/dist/index.js.LICENSE.txt +0 -5
package/dist/index.node.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(()=>{var e={559:e=>{var l={aspx:"asp",bash:"shell","c++":"cplusplus","c#":"csharp",clj:"clojure",cljc:"clojure",cljx:"clojure",coffeescript:"javascript",cpp:"cplusplus",cql:"sql",cs:"csharp",docker:"dockerfile",ecmascript:"javascript",erl:"erlang",gql:"graphql",gradle:"groovy",handlebars:"html",hbs:"html",jl:"julia",jruby:"ruby",js:"javascript",kt:"kotlin",less:"css",macruby:"ruby",md:"markdown",ml:"ocaml",mssql:"sql",mysql:"sql",node:"javascript","obj-c":"objectivec","obj-c++":"objectivecplusplus","objc++":"objectivecplusplus",objc:"objectivec",objcpp:"objectivecplusplus",objectivecpp:"objectivecplusplus",pgsql:"sql",pl:"perl",plsql:"sql",postgres:"sql",postgresql:"sql",ps1:"powershell",py:"python",rake:"ruby",rb:"ruby",rbx:"ruby",rs:"rust",sass:"css",scss:"css",sh:"shell",solidity:"sol",sqlite:"sql",styl:"css",stylus:"css",xhtml:"html",yml:"yaml",zsh:"shell"};e.exports=function(e){return e in l?l[e]:e}},476:e=>{function l(e,l){return function(e){if(Array.isArray(e))return e}(e)||function(e,l){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==t)return;var s,r,c=[],a=!0,o=!1;try{for(t=t.call(e);!(a=(s=t.next()).done)&&(c.push(s.value),!l||c.length!==l);a=!0);}catch(e){o=!0,r=e}finally{try{a||null==t.return||t.return()}finally{if(o)throw r}}return c}(e,l)||function(e,l){if(!e)return;if("string"==typeof e)return t(e,l);var s=Object.prototype.toString.call(e).slice(8,-1);"Object"===s&&e.constructor&&(s=e.constructor.name);if("Map"===s||"Set"===s)return Array.from(e);if("Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return t(e,l)}(e,l)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(e,l){(null==l||l>e.length)&&(l=e.length);for(var t=0,s=new Array(l);t<l;t++)s[t]=e[t];return s}var s={asp:"clike",aspx:"clike",bash:"shell",c:"clike","c#":["clike","text/x-csharp"],"c++":["clike","text/x-c++src"],clj:"clojure",cljc:"clojure",cljx:"clojure",coffeescript:"javascript",cplusplus:["clike","text/x-c++src"],cpp:["clike","text/x-c++src"],cql:["sql","text/x-cassandra"],cs:["clike","text/x-csharp"],csharp:["clike","text/x-csharp"],curl:"shell",d:"d",diff:"diff",ecmascript:"javascript",erl:"erlang",go:["go","text/x-go"],gradle:"groovy",gql:"graphql",handlebars:"htmlmixed",hbs:"htmlmixed",html:"htmlmixed",java:["clike","text/x-java"],jl:"julia",js:"javascript",jsx:"jsx",json:["javascript","application/ld+json"],jruby:"ruby",kotlin:["clike","text/x-kotlin"],kt:["clike","text/x-kotlin"],less:"css",liquid:"htmlmixed",lua:"lua",node:"javascript",macruby:"ruby",markdown:"gfm",ml:["mllike","text/x-ocaml"],mssql:["sql","text/x-mssql"],mysql:["sql","text/x-mysql"],objc:["clike","text/x-objectivec"],"objc++":["clike","text/x-objectivec++"],objcpp:["clike","text/x-objectivec++"],objectivec:["clike","text/x-objectivec"],objectivecpp:["clike","text/x-objectivec++"],objectivecplusplus:["clike","text/x-objectivec++"],ocaml:["mllike","text/x-ocaml"],php:["php","text/x-php"],pgsql:["sql","text/x-pgsql"],pl:"perl",plsql:["sql","text/x-plsql"],postgres:["sql","text/x-pgsql"],postgresql:["sql","text/x-pgsql"],ps1:"powershell",py:"python",r:"r",rake:"ruby",rb:"ruby",rbx:"ruby",rs:"rust",sass:"css",scala:["clike","text/x-scala"],scss:"css",sh:"shell",sol:"clike",solidity:"clike",sql:["sql","text/x-sql"],sqlite:["sql","text/x-sqlite"],styl:"css",stylus:"css",text:["null","text/plain"],ts:["javascript","text/typescript"],typescript:["javascript","text/typescript"],xhtml:"htmlmixed",yml:"yaml",zsh:"shell"};e.exports={modes:s,getMode:function(e){var t=e;return t in s&&(t=s[t],Array.isArray(t)&&(t=l(t,2)[1])),t}}},857:e=>{var l={asp:"ASP.NET",aspx:"ASP.NET",bash:"Bash",c:"C","c#":"C#","c++":"C++",coffeescript:"CoffeeScript",clj:"Clojure",cljc:"Clojure",cljx:"Clojure",clojure:"Clojure",cplusplus:"C++",cpp:"C++",cql:"Cassandra",cs:"C#",csharp:"C#",css:"CSS",curl:"cURL",d:"D",dart:"Dart",diff:"Diff",dockerfile:"Dockerfile",ecmascript:"ECMAScript",erl:"Erlang",erlang:"Erlang",go:"Go",gql:"GraphQL",gradle:"Gradle",graphql:"GraphQL",groovy:"Groovy",handlebars:"Handlebars",hbs:"Handlebars",haml:"HAML",haxe:"Haxe",html:"HTML",http:"HTTP",java:"Java",javascript:"JavaScript",jinja2:"Jinja2",jl:"Julia",jruby:"JRuby",js:"JavaScript",json:"JSON",jsx:"JSX",julia:"Julia",kotlin:"Kotlin",kt:"Kotlin",less:"LESS",liquid:"Liquid",lua:"Lua",macruby:"MacRuby",markdown:"Markdown",md:"Markdown",ml:"OCaml",mssql:"SQL Server",mysql:"MySQL",node:"Node",objc:"Objective-C","objc++":"Objective-C++",objcpp:"Objective-C++",objectivec:"Objective-C",objectivecpp:"Objective-C++",objectivecplusplus:"Objective-C++",ocaml:"OCaml",perl:"Perl",php:"PHP",pl:"Perl",pgsql:"PL/pgSQL",plsql:"PL/SQL",postgres:"PostgreSQL",postgresql:"PostgreSQL",powershell:"PowerShell",ps1:"PowerShell",python:"Python",py:"Python",r:"R",rake:"Rake",rb:"Ruby",rbx:"Rubinius",rs:"Rust",ruby:"Ruby",rust:"Rust",sass:"Sass",scala:"Scala",scss:"SCSS",sh:"Shell",shell:"Shell",smarty:"Smarty",solidity:"Solidity",sql:"SQL",sqlite:"SQLite",stylus:"Stylus",styl:"Stylus",swift:"Swift",text:"Text",toml:"TOML",twig:"Twig",typescript:"TypeScript",xhtml:"XHTML",xml:"XML",yaml:"YAML",yml:"YAML",zsh:"Zsh"};e.exports=function(e){return e in l?l[e]:e}}},l={};function t(s){var r=l[s];if(void 0!==r)return r.exports;var c=l[s]={exports:{}};return e[s](c,c.exports,t),c.exports}t.n=e=>{var l=e&&e.__esModule?()=>e.default:()=>e;return t.d(l,{a:l}),l},t.d=(e,l)=>{for(var s in l)t.o(l,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:l[s]})},t.o=(e,l)=>Object.prototype.hasOwnProperty.call(e,l),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};(()=>{"use strict";t.r(s),t.d(s,{uppercase:()=>l.a,canonical:()=>c.a,modes:()=>a.modes,getMode:()=>a.getMode});var e=t(857),l=t.n(e),r=t(559),c=t.n(r),a=t(476)})(),module.exports=s})();
|
package/lib/enzyme.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@readme/syntax-highlighter",
|
|
3
3
|
"description": "ReadMe's React-based syntax highlighter",
|
|
4
|
-
"version": "10.
|
|
4
|
+
"version": "10.14.0",
|
|
5
5
|
"main": "dist/index.node.js",
|
|
6
6
|
"browser": "dist/index.js",
|
|
7
7
|
"license": "ISC",
|
|
@@ -11,19 +11,20 @@
|
|
|
11
11
|
},
|
|
12
12
|
"homepage": "https://readmeio.github.io/syntax-highlighter/",
|
|
13
13
|
"scripts": {
|
|
14
|
-
"build": "webpack",
|
|
14
|
+
"build": "webpack --progress",
|
|
15
15
|
"lint": "eslint . --ext .jsx --ext .js",
|
|
16
|
+
"prepack": "npm run build",
|
|
16
17
|
"prepare": "husky install",
|
|
17
|
-
"prepublishOnly": "npm run build",
|
|
18
18
|
"pretest": "npm run lint",
|
|
19
19
|
"prettier": "prettier --list-different --write \"./**/**.{js,jsx}\"",
|
|
20
|
-
"release": "conventional-changelog -i CHANGELOG.md -s && git add CHANGELOG.md",
|
|
21
|
-
"start": "webpack
|
|
20
|
+
"release": "npx conventional-changelog-cli -i CHANGELOG.md -s && git add CHANGELOG.md",
|
|
21
|
+
"start": "webpack serve --open --config ./webpack.config.dev.js",
|
|
22
22
|
"test": "jest --coverage --runInBand",
|
|
23
23
|
"watch": "webpack -w --progress"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"codemirror": "^5.48.2",
|
|
27
|
+
"codemirror-graphql": "^1.0.2",
|
|
27
28
|
"prop-types": "^15.7.2",
|
|
28
29
|
"react-codemirror2": "^7.2.1"
|
|
29
30
|
},
|
|
@@ -33,34 +34,34 @@
|
|
|
33
34
|
"react-dom": "16.x"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
|
-
"@babel/preset-env": "^7.
|
|
37
|
+
"@babel/preset-env": "^7.15.6",
|
|
37
38
|
"@babel/preset-react": "^7.14.5",
|
|
38
|
-
"@commitlint/cli": "^
|
|
39
|
-
"@commitlint/config-conventional": "^
|
|
40
|
-
"@readme/eslint-config": "^
|
|
41
|
-
"babel-jest": "^27.0
|
|
39
|
+
"@commitlint/cli": "^15.0.0",
|
|
40
|
+
"@commitlint/config-conventional": "^15.0.0",
|
|
41
|
+
"@readme/eslint-config": "^8.0.3",
|
|
42
|
+
"babel-jest": "^27.2.0",
|
|
42
43
|
"babel-loader": "^8.1.0",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"css-loader": "^5.2.4",
|
|
44
|
+
"core-js": "^3.19.3",
|
|
45
|
+
"css-loader": "^6.2.0",
|
|
46
46
|
"enzyme": "^3.11.0",
|
|
47
|
-
"enzyme-adapter-react-16": "^1.15.
|
|
48
|
-
"eslint": "^
|
|
47
|
+
"enzyme-adapter-react-16": "^1.15.6",
|
|
48
|
+
"eslint": "^8.4.1",
|
|
49
49
|
"glob": "^7.1.6",
|
|
50
|
-
"html-webpack-plugin": "^
|
|
50
|
+
"html-webpack-plugin": "^5.3.2",
|
|
51
51
|
"husky": "^7.0.1",
|
|
52
52
|
"identity-obj-proxy": "^3.0.0",
|
|
53
|
-
"jest": "^
|
|
54
|
-
"node-sass": "^
|
|
55
|
-
"prettier": "^2.
|
|
53
|
+
"jest": "^27.2.0",
|
|
54
|
+
"node-sass": "^6.0.1",
|
|
55
|
+
"prettier": "^2.4.1",
|
|
56
56
|
"react": "^16.14.0",
|
|
57
57
|
"react-dom": "^16.14.0",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"webpack": "^
|
|
62
|
-
"webpack
|
|
63
|
-
"webpack-
|
|
58
|
+
"regenerator-runtime": "^0.13.9",
|
|
59
|
+
"sass-loader": "^12.1.0",
|
|
60
|
+
"style-loader": "^3.2.1",
|
|
61
|
+
"terser-webpack-plugin": "^5.2.4",
|
|
62
|
+
"webpack": "^5.53.0",
|
|
63
|
+
"webpack-cli": "^4.8.0",
|
|
64
|
+
"webpack-dev-server": "^4.2.1"
|
|
64
65
|
},
|
|
65
66
|
"prettier": "@readme/eslint-config/prettier",
|
|
66
67
|
"husky": {
|
package/public/index.js
CHANGED
|
@@ -34,7 +34,7 @@ const exampleJson = `{
|
|
|
34
34
|
`;
|
|
35
35
|
|
|
36
36
|
ReactDOM.render(
|
|
37
|
-
<div>
|
|
37
|
+
<div style={{ margin: '20px' }}>
|
|
38
38
|
<h1>Core Syntax Highlighter</h1>
|
|
39
39
|
|
|
40
40
|
<h2>Dark Theme</h2>
|
|
@@ -99,37 +99,6 @@ ReactDOM.render(
|
|
|
99
99
|
</cmVariableContext.Provider>
|
|
100
100
|
</pre>
|
|
101
101
|
|
|
102
|
-
<h2>Custom Theme: tomorrow-night</h2>
|
|
103
|
-
<pre id="hub-reference">
|
|
104
|
-
<cmVariableContext.Provider
|
|
105
|
-
value={{
|
|
106
|
-
user: {},
|
|
107
|
-
defaults: [
|
|
108
|
-
{
|
|
109
|
-
name: 'url',
|
|
110
|
-
default: 'GET',
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
}}
|
|
114
|
-
>
|
|
115
|
-
{syntaxHighlighter(exampleCode, 'curl', {
|
|
116
|
-
customTheme: 'tomorrow-night',
|
|
117
|
-
highlightMode: true,
|
|
118
|
-
tokenizeVariables: true,
|
|
119
|
-
ranges: [
|
|
120
|
-
[
|
|
121
|
-
{ ch: 0, line: 0 },
|
|
122
|
-
{ ch: 0, line: 1 },
|
|
123
|
-
],
|
|
124
|
-
[
|
|
125
|
-
{ ch: 0, line: 4 },
|
|
126
|
-
{ ch: 0, line: 5 },
|
|
127
|
-
],
|
|
128
|
-
],
|
|
129
|
-
})}
|
|
130
|
-
</cmVariableContext.Provider>
|
|
131
|
-
</pre>
|
|
132
|
-
|
|
133
102
|
<hr />
|
|
134
103
|
<h1>Code Editor</h1>
|
|
135
104
|
<h2>Dark Theme</h2>
|
|
@@ -138,11 +107,6 @@ ReactDOM.render(
|
|
|
138
107
|
<h2>Light Theme</h2>
|
|
139
108
|
<pre id="hub-reference">{syntaxHighlighter(exampleCode, 'curl', { editable: true, dark: false })}</pre>
|
|
140
109
|
|
|
141
|
-
<h2>Custom Theme: tomorrow-night</h2>
|
|
142
|
-
<pre id="hub-reference">
|
|
143
|
-
{syntaxHighlighter(exampleCode, 'curl', { editable: true, customTheme: 'tomorrow-night' })}
|
|
144
|
-
</pre>
|
|
145
|
-
|
|
146
110
|
<hr />
|
|
147
111
|
<h1>Code Folding</h1>
|
|
148
112
|
<h2>Dark Theme</h2>
|
|
@@ -154,11 +118,6 @@ ReactDOM.render(
|
|
|
154
118
|
<pre id="hub-reference">
|
|
155
119
|
{syntaxHighlighter(exampleJson, 'json', { foldGutter: true, readOnly: true, dark: false })}
|
|
156
120
|
</pre>
|
|
157
|
-
|
|
158
|
-
<h2>Custom Theme: tomorrow-night</h2>
|
|
159
|
-
<pre id="hub-reference">
|
|
160
|
-
{syntaxHighlighter(exampleJson, 'json', { foldGutter: true, readOnly: true, customTheme: 'tomorrow-night' })}
|
|
161
|
-
</pre>
|
|
162
121
|
</div>,
|
|
163
122
|
document.getElementById('root')
|
|
164
123
|
);
|
package/src/utils/canonical.js
CHANGED
|
@@ -13,6 +13,7 @@ const modeAliases = {
|
|
|
13
13
|
docker: 'dockerfile',
|
|
14
14
|
ecmascript: 'javascript',
|
|
15
15
|
erl: 'erlang',
|
|
16
|
+
gql: 'graphql',
|
|
16
17
|
gradle: 'groovy',
|
|
17
18
|
handlebars: 'html',
|
|
18
19
|
hbs: 'html',
|
|
@@ -47,6 +48,7 @@ const modeAliases = {
|
|
|
47
48
|
sass: 'css',
|
|
48
49
|
scss: 'css',
|
|
49
50
|
sh: 'shell',
|
|
51
|
+
solidity: 'sol',
|
|
50
52
|
sqlite: 'sql',
|
|
51
53
|
styl: 'css',
|
|
52
54
|
stylus: 'css',
|
|
@@ -13,6 +13,7 @@ require('codemirror/mode/http/http');
|
|
|
13
13
|
require('codemirror/mode/javascript/javascript');
|
|
14
14
|
require('codemirror/mode/jsx/jsx');
|
|
15
15
|
require('codemirror/mode/julia/julia');
|
|
16
|
+
require('codemirror/mode/lua/lua');
|
|
16
17
|
require('codemirror/mode/mllike/mllike');
|
|
17
18
|
require('codemirror/mode/perl/perl');
|
|
18
19
|
require('codemirror/mode/php/php');
|
|
@@ -26,3 +27,4 @@ require('codemirror/mode/sql/sql');
|
|
|
26
27
|
require('codemirror/mode/swift/swift');
|
|
27
28
|
require('codemirror/mode/toml/toml');
|
|
28
29
|
require('codemirror/mode/yaml/yaml');
|
|
30
|
+
require('codemirror-graphql/mode');
|
package/src/utils/modes.js
CHANGED
|
@@ -31,6 +31,7 @@ const modes = {
|
|
|
31
31
|
erl: 'erlang',
|
|
32
32
|
go: ['go', 'text/x-go'],
|
|
33
33
|
gradle: 'groovy',
|
|
34
|
+
gql: 'graphql',
|
|
34
35
|
handlebars: 'htmlmixed',
|
|
35
36
|
hbs: 'htmlmixed',
|
|
36
37
|
html: 'htmlmixed',
|
|
@@ -44,6 +45,7 @@ const modes = {
|
|
|
44
45
|
kt: ['clike', 'text/x-kotlin'],
|
|
45
46
|
less: 'css',
|
|
46
47
|
liquid: 'htmlmixed',
|
|
48
|
+
lua: 'lua',
|
|
47
49
|
node: 'javascript',
|
|
48
50
|
macruby: 'ruby',
|
|
49
51
|
markdown: 'gfm',
|
|
@@ -74,6 +76,8 @@ const modes = {
|
|
|
74
76
|
scala: ['clike', 'text/x-scala'],
|
|
75
77
|
scss: 'css',
|
|
76
78
|
sh: 'shell',
|
|
79
|
+
sol: 'clike',
|
|
80
|
+
solidity: 'clike',
|
|
77
81
|
sql: ['sql', 'text/x-sql'],
|
|
78
82
|
sqlite: ['sql', 'text/x-sqlite'],
|
|
79
83
|
styl: 'css',
|
package/src/utils/uppercase.js
CHANGED
|
@@ -25,7 +25,9 @@ const codeTypes = {
|
|
|
25
25
|
erl: 'Erlang',
|
|
26
26
|
erlang: 'Erlang',
|
|
27
27
|
go: 'Go',
|
|
28
|
+
gql: 'GraphQL',
|
|
28
29
|
gradle: 'Gradle',
|
|
30
|
+
graphql: 'GraphQL',
|
|
29
31
|
groovy: 'Groovy',
|
|
30
32
|
handlebars: 'Handlebars',
|
|
31
33
|
hbs: 'Handlebars',
|
|
@@ -85,6 +87,7 @@ const codeTypes = {
|
|
|
85
87
|
sh: 'Shell',
|
|
86
88
|
shell: 'Shell',
|
|
87
89
|
smarty: 'Smarty',
|
|
90
|
+
solidity: 'Solidity',
|
|
88
91
|
sql: 'SQL',
|
|
89
92
|
sqlite: 'SQLite',
|
|
90
93
|
stylus: 'Stylus',
|
package/webpack.config.dev.js
CHANGED
|
@@ -2,6 +2,7 @@ const HtmlWebPackPlugin = require('html-webpack-plugin');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
4
|
module.exports = {
|
|
5
|
+
mode: 'development',
|
|
5
6
|
entry: ['./public/index.js'],
|
|
6
7
|
module: {
|
|
7
8
|
rules: [
|
|
@@ -35,10 +36,8 @@ module.exports = {
|
|
|
35
36
|
}),
|
|
36
37
|
],
|
|
37
38
|
devServer: {
|
|
38
|
-
contentBase: path.join(__dirname, 'dist'),
|
|
39
39
|
compress: true,
|
|
40
40
|
port: 3400,
|
|
41
41
|
hot: true,
|
|
42
|
-
watchContentBase: true,
|
|
43
42
|
},
|
|
44
43
|
};
|