@speed-highlight/core 1.1.10 → 1.1.12

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.
Files changed (189) hide show
  1. package/dist/detect.d.ts +8 -0
  2. package/dist/detect.js +1 -1
  3. package/dist/index.d.ts +111 -0
  4. package/dist/index.js +1 -3
  5. package/dist/languages/bash.js +1 -1
  6. package/dist/languages/docker.js +1 -1
  7. package/dist/languages/git.js +1 -1
  8. package/dist/languages/html.js +1 -1
  9. package/dist/languages/http.js +1 -1
  10. package/dist/languages/js_template_literals.js +1 -1
  11. package/dist/languages/jsdoc.js +1 -1
  12. package/dist/languages/json.js +1 -1
  13. package/dist/languages/leanpub-md.js +1 -2
  14. package/dist/languages/md.js +1 -2
  15. package/dist/languages/plain.js +1 -1
  16. package/dist/languages/py.js +1 -1
  17. package/dist/languages/regex.js +1 -1
  18. package/dist/languages/todo.js +1 -1
  19. package/dist/languages/ts.js +1 -1
  20. package/dist/languages/xml.js +1 -1
  21. package/dist/node/common.js +1 -1
  22. package/dist/node/detect.d.ts +8 -0
  23. package/dist/node/detect.js +1 -1
  24. package/dist/node/index.d.ts +111 -0
  25. package/dist/node/index.js +1 -3
  26. package/dist/node/languages/asm.js +1 -1
  27. package/dist/node/languages/bash.js +1 -1
  28. package/dist/node/languages/bf.js +1 -1
  29. package/dist/node/languages/c.js +1 -1
  30. package/dist/node/languages/css.js +1 -1
  31. package/dist/node/languages/csv.js +1 -1
  32. package/dist/node/languages/diff.js +1 -1
  33. package/dist/node/languages/docker.js +1 -1
  34. package/dist/node/languages/git.js +1 -1
  35. package/dist/node/languages/go.js +1 -1
  36. package/dist/node/languages/html.js +1 -1
  37. package/dist/node/languages/http.js +1 -1
  38. package/dist/node/languages/ini.js +1 -1
  39. package/dist/node/languages/java.js +1 -1
  40. package/dist/node/languages/js.js +1 -1
  41. package/dist/node/languages/js_template_literals.js +1 -1
  42. package/dist/node/languages/jsdoc.js +1 -1
  43. package/dist/node/languages/json.js +1 -1
  44. package/dist/node/languages/leanpub-md.js +1 -2
  45. package/dist/node/languages/log.js +1 -1
  46. package/dist/node/languages/lua.js +1 -1
  47. package/dist/node/languages/make.js +1 -1
  48. package/dist/node/languages/md.js +1 -2
  49. package/dist/node/languages/pl.js +1 -1
  50. package/dist/node/languages/plain.js +1 -1
  51. package/dist/node/languages/py.js +1 -1
  52. package/dist/node/languages/regex.js +1 -1
  53. package/dist/node/languages/rs.js +1 -1
  54. package/dist/node/languages/sql.js +1 -1
  55. package/dist/node/languages/todo.js +1 -1
  56. package/dist/node/languages/toml.js +1 -1
  57. package/dist/node/languages/ts.js +1 -1
  58. package/dist/node/languages/uri.js +1 -1
  59. package/dist/node/languages/xml.js +1 -1
  60. package/dist/node/languages/yaml.js +1 -1
  61. package/dist/node/terminal.d.ts +26 -0
  62. package/dist/terminal.d.ts +26 -0
  63. package/package.json +12 -2
  64. package/.gitattributes +0 -2
  65. package/CODE_OF_CONDUCT.md +0 -128
  66. package/CONTRIBUTING.md +0 -34
  67. package/dist/node/terminal.js +0 -1
  68. package/dist/node/themes/atom-dark.js +0 -1
  69. package/dist/node/themes/default.js +0 -1
  70. package/dist/node/themes/termcolor.js +0 -1
  71. package/dist/terminal.js +0 -1
  72. package/dist/themes/atom-dark.css +0 -1
  73. package/dist/themes/atom-dark.js +0 -1
  74. package/dist/themes/dark.css +0 -1
  75. package/dist/themes/default.css +0 -1
  76. package/dist/themes/default.js +0 -1
  77. package/dist/themes/github-dark.css +0 -1
  78. package/dist/themes/github-dim.css +0 -1
  79. package/dist/themes/github-light.css +0 -1
  80. package/dist/themes/termcolor.js +0 -1
  81. package/dist/themes/visual-studio-dark.css +0 -1
  82. package/doc/common.js.html +0 -87
  83. package/doc/css/jsdoc-template.css +0 -1
  84. package/doc/css/tomorrow.min.css +0 -2
  85. package/doc/detect%0ALanguage%20detectormodule_.html +0 -309
  86. package/doc/detect.js.html +0 -113
  87. package/doc/global.html +0 -1826
  88. package/doc/index%0ABase%20scriptmodule_.html +0 -1179
  89. package/doc/index.html +0 -402
  90. package/doc/index.js.html +0 -209
  91. package/doc/js/jsdoc-template.js +0 -2
  92. package/doc/js/jsdoc-template.js.map +0 -1
  93. package/doc/js/prettify.min.js +0 -47
  94. package/doc/term%0ATerminal%20adaptormodule_.html +0 -596
  95. package/doc/term.js.html +0 -108
  96. package/examples/data.js +0 -63
  97. package/examples/deno.js +0 -60
  98. package/examples/index.html +0 -118
  99. package/examples/languages/oneline.bash +0 -1
  100. package/examples/languages/oneline.http +0 -1
  101. package/examples/languages/screenshot.js +0 -18
  102. package/examples/languages/test.asm +0 -17
  103. package/examples/languages/test.bash +0 -32
  104. package/examples/languages/test.bf +0 -21
  105. package/examples/languages/test.c +0 -57
  106. package/examples/languages/test.css +0 -20
  107. package/examples/languages/test.csv +0 -4
  108. package/examples/languages/test.diff +0 -27
  109. package/examples/languages/test.docker +0 -23
  110. package/examples/languages/test.git +0 -10
  111. package/examples/languages/test.go +0 -21
  112. package/examples/languages/test.html +0 -27
  113. package/examples/languages/test.http +0 -17
  114. package/examples/languages/test.ini +0 -6
  115. package/examples/languages/test.java +0 -52
  116. package/examples/languages/test.js +0 -34
  117. package/examples/languages/test.jsdoc +0 -2
  118. package/examples/languages/test.json +0 -24
  119. package/examples/languages/test.leanpub-md +0 -21
  120. package/examples/languages/test.log +0 -32
  121. package/examples/languages/test.lua +0 -62
  122. package/examples/languages/test.make +0 -51
  123. package/examples/languages/test.md +0 -62
  124. package/examples/languages/test.pl +0 -25
  125. package/examples/languages/test.plain +0 -3
  126. package/examples/languages/test.py +0 -38
  127. package/examples/languages/test.regex +0 -2
  128. package/examples/languages/test.rs +0 -38
  129. package/examples/languages/test.sql +0 -6
  130. package/examples/languages/test.todo +0 -18
  131. package/examples/languages/test.toml +0 -16
  132. package/examples/languages/test.ts +0 -43
  133. package/examples/languages/test.uri +0 -9
  134. package/examples/languages/test.xml +0 -44
  135. package/examples/languages/test.yaml +0 -18
  136. package/examples/node.js +0 -11
  137. package/examples/worker.html +0 -20
  138. package/examples/worker.js +0 -6
  139. package/jsdoc.json +0 -16
  140. package/src/common.js +0 -18
  141. package/src/detect.js +0 -49
  142. package/src/index.js +0 -144
  143. package/src/languages/asm.js +0 -30
  144. package/src/languages/bash.js +0 -44
  145. package/src/languages/bf.js +0 -18
  146. package/src/languages/c.js +0 -52
  147. package/src/languages/css.js +0 -56
  148. package/src/languages/csv.js +0 -9
  149. package/src/languages/diff.js +0 -18
  150. package/src/languages/docker.js +0 -9
  151. package/src/languages/git.js +0 -20
  152. package/src/languages/go.js +0 -28
  153. package/src/languages/html.js +0 -51
  154. package/src/languages/http.js +0 -30
  155. package/src/languages/ini.js +0 -22
  156. package/src/languages/java.js +0 -28
  157. package/src/languages/js.js +0 -48
  158. package/src/languages/js_template_literals.js +0 -34
  159. package/src/languages/jsdoc.js +0 -18
  160. package/src/languages/json.js +0 -20
  161. package/src/languages/leanpub-md.js +0 -34
  162. package/src/languages/log.js +0 -28
  163. package/src/languages/lua.js +0 -28
  164. package/src/languages/make.js +0 -36
  165. package/src/languages/md.js +0 -48
  166. package/src/languages/pl.js +0 -25
  167. package/src/languages/plain.js +0 -5
  168. package/src/languages/py.js +0 -52
  169. package/src/languages/regex.js +0 -19
  170. package/src/languages/rs.js +0 -28
  171. package/src/languages/sql.js +0 -33
  172. package/src/languages/todo.js +0 -19
  173. package/src/languages/toml.js +0 -36
  174. package/src/languages/ts.js +0 -13
  175. package/src/languages/uri.js +0 -26
  176. package/src/languages/xml.js +0 -68
  177. package/src/languages/yaml.js +0 -32
  178. package/src/terminal.js +0 -42
  179. package/src/themes/atom-dark.css +0 -23
  180. package/src/themes/atom-dark.js +0 -18
  181. package/src/themes/dark.css +0 -23
  182. package/src/themes/default.css +0 -82
  183. package/src/themes/default.js +0 -18
  184. package/src/themes/github-dark.css +0 -23
  185. package/src/themes/github-dim.css +0 -3
  186. package/src/themes/github-light.css +0 -21
  187. package/src/themes/termcolor.js +0 -11
  188. package/src/themes/visual-studio-dark.css +0 -23
  189. package/typedef.js +0 -34
@@ -1,21 +0,0 @@
1
- // You might see insertions
2
- leanpub-start-insert
3
- const webpack = require("webpack");
4
- leanpub-end-insert
5
-
6
- // You might see deletions as well
7
- leanpub-start-delete
8
- const { MiniHtmlWebpackPlugin } = require("mini-html-webpack-plugin");
9
- leanpub-end-delete
10
-
11
- // Or combinations of both
12
- leanpub-start-delete
13
- const { MiniHtmlWebpackPlugin } = require("mini-html-webpack-plugin");
14
- leanpub-end-delete
15
- leanpub-start-insert
16
- x = lambda a : a + 10
17
- print(x(5))
18
- leanpub-end-insert
19
-
20
- // If content has been omitted, then ellipsis is used
21
- ...
@@ -1,32 +0,0 @@
1
- 127.0.0.1 user-identifier frank [10/Oct/2000:13:55:36 -0700] "GET /apache_pb.gif HTTP/1.0" 200 2326
2
-
3
- #Version: 1.0
4
- #Date: 12-Jan-1996 00:00:00
5
- #Fields: time cs-method cs-uri
6
- 00:34:23 GET /foo/bar.html
7
- 12:21:16 GET /foo/bar.html
8
- 12:45:52 GET /foo/bar.html
9
- 12:57:34 GET /foo/bar.html
10
-
11
- [2021-12-10][21:42:22][WARN][discord_dispatch::application_manager:1034] Failed to read install path. path=AbsolutePath { path_buf: "C:\\Users\\micha\\AppData\\Local\\DiscordGames" } error=Os { code: 3, kind: NotFound, message: "Das System kann den angegebenen Pfad nicht finden." }
12
- [2021-12-11][13:05:13][DEBUG][discord_dispatch::application_manager:195] App started. version="1.10.5"
13
-
14
- 2021-01-12T13:38:16Z containerd time="2021-01-12T13:38:16.338835400Z" level=info msg="skip loading plugin \"io.containerd.snapshotter.v1.btrfs\"..." error="path /var/lib/desktop-containerd/daemon/io.containerd.snapshotter.v1.btrfs (ext4) must be a btrfs filesystem to be used with the btrfs snapshotter: skip plugin" type=io.containerd.snapshotter.v1
15
- 2021-03-05T17:58:29Z kmsg (977696) - 2021-03-05T17:58:28.2836488Z: init: (141) ERROR: StartHostListener:356: write failed 32
16
- time="2021-01-12T14:38:11+01:00" level=info msg="🍀 socket server listening : \\\\.\\pipe\\dockerGuiToDriver"
17
-
18
- Exception in thread "main" java.lang.NullPointerException: Fictitious NullPointerException
19
- at ClassName.methodName1(ClassName.java:lineNumber)
20
- at ClassName.methodName2(ClassName.java:lineNumber)
21
- at ClassName.methodName3(ClassName.java:lineNumber)
22
- at ClassName.main(ClassName.java:lineNumber)
23
-
24
- 47.29.201.179 - - [28/Feb/2021:13:17:10 +0000] "GET /?p=1 HTTP/2.0" 200 5316 "https://domain1.com/?p=1" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36" "2.75"
25
- Mar 19 22:10:24 xxxxxxx journal: xxxxxxxx.mylabserver.com nginx: photos.example.com 127.0.0.1 - - [19/Mar/2018:22:10:24 +0000] "GET / HTTP/1.1" 200 53324 "-" "curl/7.29.0" "-"
26
- TLSv1.2 AES128-SHA 1.1.1.1 "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
27
-
28
- 4/1/2021 14:15:27 - PFRO Error: \??\C:\Windows\system32\spool\DRIVERS\x64\3\New\FXSAPI.DLL, \??\C:\Windows\system32\spool\DRIVERS\x64\3\FXSAPI.DLL, 0xc000003a
29
- AudMig: Device Ids match - {5}.\?hdaudio#func_03&ven_40de&dev_0083&subsys_50de130f&rev_4003#1&13efefe3&0&0004#{6993ad03-95ef-33d0-a2cc-00a0c9322596} opo04/00040002 {2}.\?hdaudio#func_01&ven_40de&dev_0084&subsys_10de310f&rev_1004#2&22efefe2&0&0004#{6994ad04-94ef-32d0-a1cc-00a0c9181396} opo04/00030001
30
- AudMig: Migrated {a31c434e-df4c-1efd-8010-67d416a840e0},2 property at 3
31
-
32
- [07:28:21] [Server thread/INFO] [FML]: Invalid recipe found with multiple oredict ingredients in the same ingred
@@ -1,62 +0,0 @@
1
- #!/bin/lua
2
-
3
- --[=[
4
- This is also a block comment
5
- We can include "]]" inside this comment
6
- --]=]
7
-
8
- --[==[
9
- This is also a block comment
10
- We can include "]=]" inside this comment
11
- f --]==]
12
-
13
- vf --tst
14
-
15
- a = 'alo\n123"'
16
- a = "alo\n123\""
17
- a = '\97lo\10\04923"'
18
- a = [[alo
19
- 123"]]
20
- a = [==[
21
- alo
22
- 123"]==]
23
-
24
- var ::= prefixexp `[´ exp `]´
25
-
26
- stat ::= while exp do block end
27
- stat ::= repeat block until exp
28
- stat ::= if exp then block {elseif exp then block} [else block] end
29
-
30
- do
31
- local f, s, var = explist
32
- while true do
33
- local var_1, ···, var_n = f(s, var)
34
- var = var_1
35
- if var == nil then break end
36
- block
37
- end
38
- end
39
-
40
- do
41
- local t = {}
42
- t[f(1)] = g
43
- t[1] = "x" -- 1st exp
44
- t[2] = "y" -- 2nd exp
45
- t.x = 1 -- t["x"] = 1
46
- t[3] = f(x) -- 3rd exp
47
- t[30] = 23
48
- t[4] = 45 -- 4th exp
49
- a = t
50
- end
51
-
52
- function max(num1, num2)
53
-
54
- if (num1 > num2) then
55
- result = num1;
56
- else
57
- result = num2;
58
- end
59
-
60
- return result;
61
- end
62
- --]=]
@@ -1,51 +0,0 @@
1
- PACKAGE = package
2
- VERSION = ` date "+%Y.%m%d%" `
3
- RELEASE_DIR = ..
4
- RELEASE_FILE = $(PACKAGE)-$(VERSION)
5
-
6
- # that won't understand these lines
7
- ifneq (,)
8
- This makefile requires GNU Make.
9
- endif
10
-
11
- # Notice that the variable LOGNAME comes from the environment in
12
- # POSIX shells.
13
- #
14
- # target: all - Default target. Does nothing.
15
- all:
16
- echo "Hello $(LOGNAME), nothing to do by default"
17
- # TODO sometimes: echo "Hello ${LOGNAME}, nothing to do by default"
18
- echo "Try 'make help'"
19
-
20
- # target: help - Display callable targets.
21
- help:
22
- egrep "^# target:" [Mm]akefile
23
-
24
- # target: list - List source files
25
- list:
26
- # Won't work. Each command is in separate shell
27
- @cd src
28
- ls
29
-
30
- # Correct, continuation of the same shell
31
- cd src; \
32
- ls
33
-
34
- # target: dist - Make a release.
35
- dist:
36
- tar -cf $(RELEASE_DIR)/$(RELEASE_FILE) && \
37
- gzip -9 $(RELEASE_DIR)/$(RELEASE_FILE).tar
38
-
39
- %.txt : %.html
40
- lynx -dump $< > $@
41
-
42
-
43
- # This is an explicit suffix rule. It may be omitted on systems
44
- # that handle simple rules like this automatically.
45
- .c.o:
46
- $(CC) $(CFLAGS) -c $<
47
-
48
- FRC:
49
- .SUFFIXES: .c
50
-
51
- .PHONY: clean depend
@@ -1,62 +0,0 @@
1
- Heading
2
- =======
3
-
4
- Sub-heading
5
- -----------
6
-
7
- Paragraphs are separated
8
- by a blank line.
9
-
10
- Two spaces at the end of a line
11
- produce a line break.
12
-
13
- Text attributes _italic_,
14
- **bold**, `monospace`. Some `console.log(lst.filter(e => e == true))` implementations may use *single-asterisks* for italic text.
15
-
16
- Horizontal rule:
17
-
18
- ---
19
-
20
- ```
21
- <link rel="stylesheet" href="style.css">
22
- <link rel="favicon">
23
- ```
24
-
25
- ```js
26
- for (let y = 0; y <= size; y++) {
27
- console.log(state.map(star => (star ? '*' : ' ')).join(''));
28
- state = state.map((_, i, arr) => arr[i + 1] || arr[i - 1]);
29
- }
30
- ```
31
-
32
- ```beurihiuerh
33
- }
34
- ```
35
-
36
- Strikethrough:
37
- ~~strikethrough~~
38
-
39
- Bullet list:
40
-
41
- * apples
42
- * oranges
43
- * pears
44
-
45
- Numbered list:
46
-
47
- 1. lather
48
- 2. rinse
49
- 3. repeat
50
-
51
- An [example](http://example.com).
52
-
53
- ![Image](Icon-pictures.png "icon")
54
-
55
- > Markdown uses email-style
56
- > characters for blockquoting.
57
- > Multiple paragraphs need to be prepended individually.
58
-
59
- | Item | Price | # In stock |
60
- |--------------|-----------|------------|
61
- | Juicy Apples | 1.99 | *7* |
62
- | Bananas | **1.89** | 5234 |
@@ -1,25 +0,0 @@
1
- #!/usr/bin/perl
2
-
3
- use strict;
4
- use warnings;
5
-
6
- # This would print with a line break in the middle
7
- print "Hello
8
- world\n";
9
- $a = 10;
10
- print "Value of a = $a\n";
11
-
12
- $var = <<'EOF';
13
-
14
- my ( $remaining, $total );
15
-
16
- $remaining = $total = shift(@ARGV);
17
-
18
- STDOUT->autoflush(1);
19
-
20
- while ( $remaining ) {
21
- printf ( "Remaining %s/%s \r", $remaining--, $total );
22
- sleep 1;
23
- }
24
-
25
- print "\n";
@@ -1,3 +0,0 @@
1
- In computing, plain text is a loose term for data (e.g. file contents) that represent only characters of readable material but not its graphical representation nor other objects (floating-point numbers, images, etc.).
2
- It may also include a limited number of "whitespace" characters that affect simple arrangement of text, such as spaces, line breaks, or tabulation characters (although tab characters can "mean" many different things, so are hardly "plain").
3
- Plain text is different from formatted text, where style information is included; from structured text, where structural parts of the document such as paragraphs, sections, and the like are identified; and from binary files in which some portions must be interpreted as binary objects (encoded integers, real numbers, images, etc.).
@@ -1,38 +0,0 @@
1
- #This is a comment
2
- #written in
3
- #more than just one line
4
-
5
- """
6
- This is a comment
7
- written in
8
- more than just one line
9
- """
10
- def fib(n):
11
- a, b = 0, 1
12
- while a < n:
13
- print(a, end=' ')
14
- a, b = b, a+b
15
- print()
16
- fib(1000)
17
- numbers = [2, 4, 6, 8]
18
- """
19
- This is a comment
20
- written in
21
- more than just one line
22
- """
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
- class MyClass:
32
- def __init__():
33
- x = 5
34
- x = "%1 test" % name
35
- x = f"test{x > 5} t est\n {numbers} {{{test}}}"
36
- x = F"test{x > 5} test\n {numbers} {{\{test}}}\" test
37
-
38
- x = lambda a : a + 10
@@ -1,2 +0,0 @@
1
- /([A-Z])\w+\d{0,9}/gi
2
- TODO comment
@@ -1,38 +0,0 @@
1
- /*
2
- create a simple multithreaded server
3
- */
4
-
5
- //include the library
6
- use std::net::{TcpListener, TcpStream};
7
- use std::io::{Read, Write};
8
- use std::thread;
9
-
10
- //function that handles the client
11
- fn handle_client(mut stream: TcpStream) {
12
- //read the message
13
- let mut buffer = [0; 512];
14
- stream.read(&mut buffer).unwrap();
15
- //print the message
16
- println!("{}", String::from_utf8_lossy(&buffer[..]));
17
- //write the message back
18
- stream.write(&buffer).unwrap();
19
- }
20
-
21
- //main function
22
- fn main() {
23
- //create a listener
24
- let listener = TcpListener::bind("127.0.0.1:8080").unwrap();
25
- //listen for connections
26
- for stream in listener.incoming() {
27
- //handle the connection
28
- match stream {
29
- Ok(stream) => {
30
- thread::spawn(move || {
31
- handle_client(stream);
32
- });
33
- }
34
- Err(e) => {
35
- println!("Error: {}", e);
36
- }
37
- }
38
- }
@@ -1,6 +0,0 @@
1
- -- Comment
2
- SELECT 'Geeks' || ' ' || @test_hello FROM dual;
3
- INSERT INTO database (geek_id, geek_name) VALUES (5000, 'abc');
4
- REPLACE('123geeks123', '123', TRUE);
5
- /* FIXME Multiline
6
- Comment */
@@ -1,18 +0,0 @@
1
- TODO ...
2
- FIXME ...
3
- CHANGED ...
4
- CHANGE ...
5
- FIX ...
6
- XXX ...
7
- IDEA ...
8
- HACK ...
9
- NOTE ...
10
- REVIEW ...
11
- NB ...
12
- BUG ...
13
- QUESTION ...
14
- COMBAK ...
15
- TEMP ...
16
- DEBUG ...
17
- OPTIMIZE ...
18
- WARNING ...
@@ -1,16 +0,0 @@
1
- # CHANGED This is a TOML document
2
-
3
- title = "TOML Example"
4
-
5
- [owner]
6
- name = "Tom Preston-Werner"
7
- dob = 1979-05-27T07:32:00-08:00
8
-
9
- [database]
10
- enabled = true
11
- ports = [ 8000, inf, 8002 ]
12
- data = [ ["delta", "phi"], [3.14] ]
13
- temp_targets = { cpu = 79.5, case = 72.0 }
14
- re = """
15
- test
16
- """
@@ -1,43 +0,0 @@
1
- type Result = "pass" | "fail"
2
-
3
- interface User {
4
- id: number
5
- firstName: string
6
- lastName: string
7
- role: string
8
- result: Result
9
- }
10
-
11
- const test = {
12
- test: value
13
- };
14
-
15
- function updateUser(id: number, update: Partial<User>) {
16
- const user = getUser(id)
17
- const newUser = { ...user, ...update }
18
- saveUser(id, newUser)
19
- }
20
-
21
- function compact(arr: string[]) {
22
- if (arr.length > 10)
23
- return arr.slice(0, 10)
24
- return arr
25
- }
26
-
27
- namespace Validation {
28
- export interface StringValidator {
29
- isAcceptable(s: string): boolean;
30
- }
31
- const lettersRegexp = /^[A-Za-z]+$/;
32
- const numberRegexp = /^[0-9]+$/;
33
- export class LettersOnlyValidator implements StringValidator {
34
- isAcceptable(s: string) {
35
- return lettersRegexp.test(s);
36
- }
37
- }
38
- export class ZipCodeValidator implements StringValidator {
39
- isAcceptable(s: string) {
40
- return s.length === 5 && numberRegexp.test(s);
41
- }
42
- }
43
- }
@@ -1,9 +0,0 @@
1
- https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top
2
- # TODO more uri
3
- http://github.matubu.com/shj/examples/index.html
4
- ldap://[2001:db8::7]/c=GB?objectClass?one
5
- mailto:John.Doe@example.com
6
- news:comp.infosystems.www.servers.unix
7
- tel:+1-816-555-1212
8
- telnet://192.0.2.16:80/
9
- urn:oasis:names:specification:docbook:dtd:xml:4.1.2
@@ -1,44 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!--Simple example from w3schools-->
3
- <breakfast_menu>
4
- <food>
5
- <name>Belgian Waffles</name>
6
- <price>$5.95</price>
7
- <description>
8
- Two of our famous Belgian Waffles with plenty of real maple syrup
9
- </description>
10
- <calories>650</calories>
11
- </food>
12
- <food>
13
- <name>Strawberry Belgian Waffles</name>
14
- <price>$7.95</price>
15
- <description>
16
- Light Belgian waffles covered with strawberries and whipped cream
17
- </description>
18
- <calories>900</calories>
19
- </food>
20
- <food>
21
- <name>Berry-Berry Belgian Waffles</name>
22
- <price>$8.95</price>
23
- <description>
24
- Belgian waffles covered with assorted fresh berries and whipped cream
25
- </description>
26
- <calories>900</calories>
27
- </food>
28
- <food>
29
- <name>French Toast</name>
30
- <price>$4.50</price>
31
- <description>
32
- Thick slices made from our homemade sourdough bread
33
- </description>
34
- <calories>600</calories>
35
- </food>
36
- <food>
37
- <name>Homestyle Breakfast</name>
38
- <price>$6.95</price>
39
- <description>
40
- Two eggs, bacon or sausage, toast, and our ever-popular hash browns
41
- </description>
42
- <calories>950</calories>
43
- </food>
44
- </breakfast_menu>
@@ -1,18 +0,0 @@
1
- --- # The Smiths
2
- - {name: John Smith, age: 33}
3
- - name: Mary Smith
4
- age: !!str 27
5
- - [name, age]: [Rae Smith, 4] # sequences as kwds are supported
6
- --- # TODO People, by gender
7
- men: ["John Smith", 'Bill Jones', Yes]
8
- data: >
9
- Wrapped text
10
- will be folded
11
- into a single
12
- paragraph
13
-
14
- Blank lines denote
15
- paragraph breaks
16
- women:
17
- - Mary Smith
18
- - Susan Williams
package/examples/node.js DELETED
@@ -1,11 +0,0 @@
1
- const fs = require('fs'),
2
- path = require('path'),
3
- { setTheme, printHighlight } = require('@speed-highlight/core/terminal');
4
-
5
- const lang = process.argv[2] ?? 'js';
6
-
7
- setTheme('default').then(_ => {
8
- const code = fs.readFileSync(path.resolve(__dirname, `./languages/test.${lang}`));
9
-
10
- printHighlight(code, lang);
11
- });
@@ -1,20 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Web worker | Speed highlight JS</title>
7
- <link rel="stylesheet" href="../src/themes/atom-dark.css">
8
- </head>
9
- <body>
10
- <div class="shj-lang-js shj-multiline shj-mode-noheader" id="code">this.code = 'highlighted on a web worker';
11
- this.isAwesome = new Boolean(.5);
12
- this.doesNotWorkOnFirefox = '💩'</div>
13
- <script type="module">
14
- const code = document.querySelector('#code');
15
- const worker = new Worker('./worker.js', { type: "module" });
16
- worker.onmessage = e => code.innerHTML = e.data;
17
- worker.postMessage([code.textContent, 'js']);
18
- </script>
19
- </body>
20
- </html>
@@ -1,6 +0,0 @@
1
- import { highlightText } from '../src/index.js'
2
-
3
- onmessage = async e => {
4
- const result = await highlightText(e.data[0], e.data[1] || 'js');
5
- postMessage(result);
6
- };
package/jsdoc.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "plugins": [],
3
- "recurseDepth": 10,
4
- "source": {
5
- "includePattern": ".+\\.js$"
6
- },
7
- "sourceType": "module",
8
- "tags": {
9
- "allowUnknownTags": true,
10
- "dictionaries": ["jsdoc", "closure"]
11
- },
12
- "templates": {
13
- "cleverLinks": false,
14
- "monospaceLinks": false
15
- }
16
- }
package/src/common.js DELETED
@@ -1,18 +0,0 @@
1
- /**
2
- * Commonly used match pattern
3
- */
4
-
5
- export default {
6
- num: {
7
- type: 'num',
8
- match: /(\.e?|\b)\d(e-|[\d.oxa-fA-F_])*(\.|\b)/g
9
- },
10
- str: {
11
- type: 'str',
12
- match: /(["'])(\\[^]|(?!\1)[^\r\n\\])*\1?/g
13
- },
14
- strDouble: {
15
- type: 'str',
16
- match: /"((?!")[^\r\n\\]|\\[^])*"?/g
17
- }
18
- }
package/src/detect.js DELETED
@@ -1,49 +0,0 @@
1
- /**
2
- * @module detect
3
- * (Language detector)
4
- */
5
-
6
- import '../typedef.js'
7
-
8
- /**
9
- * @type {Array.<[ShjLanguage, ...[RegExp, Number][]]>}
10
- */
11
- const languages = [
12
- ['bash', [/#!(\/usr)?\/bin\/bash/g, 500], [/\b(if|elif|then|fi|echo)\b|\$/g, 10]],
13
- ['html', [/<\/?[a-z-]+[^\n>]*>/g, 10], [/^\s+<!DOCTYPE\s+html/g, 500]],
14
- ['http', [/^(GET|HEAD|POST|PUT|DELETE|PATCH|HTTP)\b/g, 500]],
15
- ['js', [/\b(console|await|async|function|export|import|this|class|for|let|const|map|join|require)\b/g, 10]],
16
- ['ts', [/\b(console|await|async|function|export|import|this|class|for|let|const|map|join|require|implements|interface|namespace)\b/g, 10]],
17
- ['py', [/\b(def|print|class|and|or|lambda)\b/g, 10]],
18
- ['sql', [/\b(SELECT|INSERT|FROM)\b/g, 50]],
19
- ['pl', [/#!(\/usr)?\/bin\/perl/g, 500], [/\b(use|print)\b|\$/g, 10]],
20
- ['lua', [/#!(\/usr)?\/bin\/lua/g, 500]],
21
- ['make', [/\b(ifneq|endif|if|elif|then|fi|echo|.PHONY|^[a-z]+ ?:$)\b|\$/gm, 10]],
22
- ['uri', [/https?:|mailto:|tel:|ftp:/g, 30]],
23
- ['css', [/^(@import|@page|@media|(\.|#)[a-z]+)/gm, 20]],
24
- ['diff', [/^[+><-]/gm, 10], [/^@@ ?[-+,0-9 ]+ ?@@/gm, 25]],
25
- ['md', [/^(>|\t\*|\t\d+.)/gm, 10], [/\[.*\](.*)/g, 10]],
26
- ['docker', [/^(FROM|ENTRYPOINT|RUN)/gm, 500]],
27
- ['xml', [/<\/?[a-z-]+[^\n>]*>/g, 10], [/^<\?xml/g, 500]],
28
- ['c', [/#include\b|\bprintf\s+\(/g, 100]],
29
- ['rs', [/^\s+(use|fn|mut|match)\b/gm, 100]],
30
- ['go', [/\b(func|fmt|package)\b/g, 100]],
31
- ['java', [/^import\s+java/gm, 500]],
32
- ['asm', [/^(section|global main|extern|\t(call|mov|ret))/gm, 100]],
33
- ]
34
-
35
- /**
36
- * @function detectLanguage
37
- * Try to find the language the given code belong to
38
- * @param {String} code The code
39
- * @returns {ShjLanguage} The language of the code
40
- */
41
- export const detectLanguage = code => {
42
- return (languages
43
- .map(([lang, ...features]) => [
44
- lang,
45
- features.reduce((acc, [match, score]) => acc + [...code.matchAll(match)].length * score, 0)
46
- ])
47
- .filter(([lang, score]) => score > 20)
48
- .sort((a, b) => b[1] - a[1])[0]?.[0] || 'plain');
49
- }