rapier-html 1.2.45 → 1.2.48

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 (55) hide show
  1. package/BUILD.json +16 -16
  2. package/README.md +13 -12
  3. package/dist/ledger/LICENSE +12 -5
  4. package/dist/ledger/authored-origin.mjs +2 -2
  5. package/dist/ledger/authorship.mjs +5 -5
  6. package/dist/ledger/carried.mjs +21 -12
  7. package/dist/ledger/diff/concerns.mjs +3 -3
  8. package/dist/ledger/diff/diff.mjs +6 -6
  9. package/dist/ledger/diff/index.mjs +2 -2
  10. package/dist/ledger/diff/merge.mjs +3 -3
  11. package/dist/ledger/diff/moves.mjs +1 -1
  12. package/dist/ledger/diff/walk.mjs +1 -1
  13. package/dist/ledger/document-fonts.mjs +296 -0
  14. package/dist/ledger/document-settings.mjs +2 -2
  15. package/dist/ledger/format.mjs +14 -12
  16. package/dist/ledger/history.mjs +7 -7
  17. package/dist/ledger/inverse-source.mjs +5 -5
  18. package/dist/ledger/journal-records.mjs +3 -3
  19. package/dist/ledger/math/delimiters.mjs +38 -0
  20. package/dist/ledger/math/markdown-rules.mjs +103 -0
  21. package/dist/ledger/md-assets.mjs +3 -2
  22. package/dist/ledger/md-comments.mjs +384 -0
  23. package/dist/ledger/md-engine.mjs +157 -0
  24. package/dist/ledger/md-marks.mjs +10 -1
  25. package/dist/ledger/md-parser-config.mjs +463 -0
  26. package/dist/ledger/md-parser-runtime.mjs +23 -0
  27. package/dist/ledger/md-source.mjs +1 -1
  28. package/dist/ledger/source.mjs +31 -2
  29. package/dist/ledger/template-page.mjs +1 -1
  30. package/dist/ledger/transport.mjs +66 -7
  31. package/dist/ledger/vendor/NOTICE.txt +60 -0
  32. package/dist/ledger/vendor/SOURCES.json +253 -0
  33. package/dist/ledger/vendor/entities/decode-codepoint.mjs +27 -0
  34. package/dist/ledger/vendor/entities.mjs +499 -0
  35. package/dist/ledger/vendor/linkify-it.mjs +427 -0
  36. package/dist/ledger/vendor/markdown-it.mjs +4027 -0
  37. package/dist/ledger/vendor/markdown-licenses/entities-LICENSE.txt +11 -0
  38. package/dist/ledger/vendor/markdown-licenses/linkify-it-LICENSE.txt +22 -0
  39. package/dist/ledger/vendor/markdown-licenses/markdown-it-LICENSE.txt +22 -0
  40. package/dist/ledger/vendor/markdown-licenses/mdurl-LICENSE.txt +45 -0
  41. package/dist/ledger/vendor/markdown-licenses/punycode.js-LICENSE-MIT.txt +20 -0
  42. package/dist/ledger/vendor/markdown-licenses/uc.micro-LICENSE.txt +20 -0
  43. package/dist/ledger/vendor/markdown-plugins.mjs +1344 -0
  44. package/dist/ledger/vendor/markdown-runtime.mjs +5 -0
  45. package/dist/ledger/vendor/mdurl/index.mjs +11 -0
  46. package/dist/ledger/vendor/mdurl/lib/decode.mjs +107 -0
  47. package/dist/ledger/vendor/mdurl/lib/encode.mjs +77 -0
  48. package/dist/ledger/vendor/mdurl/lib/format.mjs +20 -0
  49. package/dist/ledger/vendor/mdurl/lib/parse.mjs +231 -0
  50. package/dist/ledger/vendor/punycode.mjs +282 -0
  51. package/dist/ledger/vendor/uc.micro.mjs +49 -0
  52. package/dist/page.mjs +11 -3
  53. package/dist/rapier.html +113 -75
  54. package/dist/wrap.mjs +10 -5
  55. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ import markdownIt from './markdown-it.mjs';
2
+
3
+ export function markdownItConstructor() {
4
+ return markdownIt;
5
+ }
@@ -0,0 +1,11 @@
1
+ import decode from './lib/decode.mjs'
2
+ import encode from './lib/encode.mjs'
3
+ import format from './lib/format.mjs'
4
+ import parse from './lib/parse.mjs'
5
+
6
+ export {
7
+ decode,
8
+ encode,
9
+ format,
10
+ parse
11
+ }
@@ -0,0 +1,107 @@
1
+ /* eslint-disable no-bitwise */
2
+
3
+ const decodeCache = {}
4
+
5
+ function getDecodeCache (exclude) {
6
+ let cache = decodeCache[exclude]
7
+ if (cache) { return cache }
8
+
9
+ cache = decodeCache[exclude] = []
10
+
11
+ for (let i = 0; i < 128; i++) {
12
+ const ch = String.fromCharCode(i)
13
+ cache.push(ch)
14
+ }
15
+
16
+ for (let i = 0; i < exclude.length; i++) {
17
+ const ch = exclude.charCodeAt(i)
18
+ cache[ch] = '%' + ('0' + ch.toString(16).toUpperCase()).slice(-2)
19
+ }
20
+
21
+ return cache
22
+ }
23
+
24
+ function decode (string, exclude) {
25
+ if (typeof exclude !== 'string') {
26
+ exclude = decode.defaultChars
27
+ }
28
+
29
+ const cache = getDecodeCache(exclude)
30
+
31
+ return string.replace(/(%[a-f0-9]{2})+/gi, function (seq) {
32
+ let result = ''
33
+
34
+ for (let i = 0, l = seq.length; i < l; i += 3) {
35
+ const b1 = parseInt(seq.slice(i + 1, i + 3), 16)
36
+
37
+ if (b1 < 0x80) {
38
+ result += cache[b1]
39
+ continue
40
+ }
41
+
42
+ if ((b1 & 0xE0) === 0xC0 && (i + 3 < l)) {
43
+ const b2 = parseInt(seq.slice(i + 4, i + 6), 16)
44
+
45
+ if ((b2 & 0xC0) === 0x80) {
46
+ const chr = ((b1 << 6) & 0x7C0) | (b2 & 0x3F)
47
+
48
+ if (chr < 0x80) {
49
+ result += '\ufffd\ufffd'
50
+ } else {
51
+ result += String.fromCharCode(chr)
52
+ }
53
+
54
+ i += 3
55
+ continue
56
+ }
57
+ }
58
+
59
+ if ((b1 & 0xF0) === 0xE0 && (i + 6 < l)) {
60
+ const b2 = parseInt(seq.slice(i + 4, i + 6), 16)
61
+ const b3 = parseInt(seq.slice(i + 7, i + 9), 16)
62
+
63
+ if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {
64
+ const chr = ((b1 << 12) & 0xF000) | ((b2 << 6) & 0xFC0) | (b3 & 0x3F)
65
+
66
+ if (chr < 0x800 || (chr >= 0xD800 && chr <= 0xDFFF)) {
67
+ result += '\ufffd\ufffd\ufffd'
68
+ } else {
69
+ result += String.fromCharCode(chr)
70
+ }
71
+
72
+ i += 6
73
+ continue
74
+ }
75
+ }
76
+
77
+ if ((b1 & 0xF8) === 0xF0 && (i + 9 < l)) {
78
+ const b2 = parseInt(seq.slice(i + 4, i + 6), 16)
79
+ const b3 = parseInt(seq.slice(i + 7, i + 9), 16)
80
+ const b4 = parseInt(seq.slice(i + 10, i + 12), 16)
81
+
82
+ if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80 && (b4 & 0xC0) === 0x80) {
83
+ let chr = ((b1 << 18) & 0x1C0000) | ((b2 << 12) & 0x3F000) | ((b3 << 6) & 0xFC0) | (b4 & 0x3F)
84
+
85
+ if (chr < 0x10000 || chr > 0x10FFFF) {
86
+ result += '\ufffd\ufffd\ufffd\ufffd'
87
+ } else {
88
+ chr -= 0x10000
89
+ result += String.fromCharCode(0xD800 + (chr >> 10), 0xDC00 + (chr & 0x3FF))
90
+ }
91
+
92
+ i += 9
93
+ continue
94
+ }
95
+ }
96
+
97
+ result += '\ufffd'
98
+ }
99
+
100
+ return result
101
+ })
102
+ }
103
+
104
+ decode.defaultChars = ';/?:@&=+$,#'
105
+ decode.componentChars = ''
106
+
107
+ export default decode
@@ -0,0 +1,77 @@
1
+ const encodeCache = {}
2
+
3
+ function getEncodeCache (exclude) {
4
+ let cache = encodeCache[exclude]
5
+ if (cache) { return cache }
6
+
7
+ cache = encodeCache[exclude] = []
8
+
9
+ for (let i = 0; i < 128; i++) {
10
+ const ch = String.fromCharCode(i)
11
+
12
+ if (/^[0-9a-z]$/i.test(ch)) {
13
+ cache.push(ch)
14
+ } else {
15
+ cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2))
16
+ }
17
+ }
18
+
19
+ for (let i = 0; i < exclude.length; i++) {
20
+ cache[exclude.charCodeAt(i)] = exclude[i]
21
+ }
22
+
23
+ return cache
24
+ }
25
+
26
+ function encode (string, exclude, keepEscaped) {
27
+ if (typeof exclude !== 'string') {
28
+ keepEscaped = exclude
29
+ exclude = encode.defaultChars
30
+ }
31
+
32
+ if (typeof keepEscaped === 'undefined') {
33
+ keepEscaped = true
34
+ }
35
+
36
+ const cache = getEncodeCache(exclude)
37
+ let result = ''
38
+
39
+ for (let i = 0, l = string.length; i < l; i++) {
40
+ const code = string.charCodeAt(i)
41
+
42
+ if (keepEscaped && code === 0x25 && i + 2 < l) {
43
+ if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {
44
+ result += string.slice(i, i + 3)
45
+ i += 2
46
+ continue
47
+ }
48
+ }
49
+
50
+ if (code < 128) {
51
+ result += cache[code]
52
+ continue
53
+ }
54
+
55
+ if (code >= 0xD800 && code <= 0xDFFF) {
56
+ if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {
57
+ const nextCode = string.charCodeAt(i + 1)
58
+ if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {
59
+ result += encodeURIComponent(string[i] + string[i + 1])
60
+ i++
61
+ continue
62
+ }
63
+ }
64
+ result += '%EF%BF%BD'
65
+ continue
66
+ }
67
+
68
+ result += encodeURIComponent(string[i])
69
+ }
70
+
71
+ return result
72
+ }
73
+
74
+ encode.defaultChars = ";/?:@&=+$,-_.!~*'()#"
75
+ encode.componentChars = "-_.!~*'()"
76
+
77
+ export default encode
@@ -0,0 +1,20 @@
1
+ export default function format (url) {
2
+ let result = ''
3
+
4
+ result += url.protocol || ''
5
+ result += url.slashes ? '//' : ''
6
+ result += url.auth ? url.auth + '@' : ''
7
+
8
+ if (url.hostname && url.hostname.indexOf(':') !== -1) {
9
+ result += '[' + url.hostname + ']'
10
+ } else {
11
+ result += url.hostname || ''
12
+ }
13
+
14
+ result += url.port ? ':' + url.port : ''
15
+ result += url.pathname || ''
16
+ result += url.search || ''
17
+ result += url.hash || ''
18
+
19
+ return result
20
+ };
@@ -0,0 +1,231 @@
1
+ /*!
2
+ Copyright Joyent, Inc. and other Node contributors.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a
5
+ copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to permit
9
+ persons to whom the Software is furnished to do so, subject to the
10
+ following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included
13
+ in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
18
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
19
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ */
23
+
24
+
25
+ function Url () {
26
+ this.protocol = null
27
+ this.slashes = null
28
+ this.auth = null
29
+ this.port = null
30
+ this.hostname = null
31
+ this.hash = null
32
+ this.search = null
33
+ this.pathname = null
34
+ }
35
+
36
+
37
+ const protocolPattern = /^([a-z0-9.+-]+:)/i
38
+ const portPattern = /:[0-9]*$/
39
+
40
+ /* eslint-disable-next-line no-useless-escape */
41
+ const simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/
42
+
43
+ const delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t']
44
+
45
+ const unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims)
46
+
47
+ const autoEscape = ['\''].concat(unwise)
48
+ const nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape)
49
+ const hostEndingChars = ['/', '?', '#']
50
+ const hostnameMaxLen = 255
51
+ const hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/
52
+ const hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/
53
+ const hostlessProtocol = {
54
+ javascript: true,
55
+ 'javascript:': true
56
+ }
57
+ const slashedProtocol = {
58
+ http: true,
59
+ https: true,
60
+ ftp: true,
61
+ gopher: true,
62
+ file: true,
63
+ 'http:': true,
64
+ 'https:': true,
65
+ 'ftp:': true,
66
+ 'gopher:': true,
67
+ 'file:': true
68
+ }
69
+
70
+ function urlParse (url, slashesDenoteHost) {
71
+ if (url && url instanceof Url) return url
72
+
73
+ const u = new Url()
74
+ u.parse(url, slashesDenoteHost)
75
+ return u
76
+ }
77
+
78
+ Url.prototype.parse = function (url, slashesDenoteHost) {
79
+ let lowerProto, hec, slashes
80
+ let rest = url
81
+
82
+ rest = rest.trim()
83
+
84
+ if (!slashesDenoteHost && url.split('#').length === 1) {
85
+ const simplePath = simplePathPattern.exec(rest)
86
+ if (simplePath) {
87
+ this.pathname = simplePath[1]
88
+ if (simplePath[2]) {
89
+ this.search = simplePath[2]
90
+ }
91
+ return this
92
+ }
93
+ }
94
+
95
+ let proto = protocolPattern.exec(rest)
96
+ if (proto) {
97
+ proto = proto[0]
98
+ lowerProto = proto.toLowerCase()
99
+ this.protocol = proto
100
+ rest = rest.substr(proto.length)
101
+ }
102
+
103
+ /* eslint-disable-next-line no-useless-escape */
104
+ if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
105
+ slashes = rest.substr(0, 2) === '//'
106
+ if (slashes && !(proto && hostlessProtocol[proto])) {
107
+ rest = rest.substr(2)
108
+ this.slashes = true
109
+ }
110
+ }
111
+
112
+ if (!hostlessProtocol[proto] &&
113
+ (slashes || (proto && !slashedProtocol[proto]))) {
114
+
115
+
116
+ let hostEnd = -1
117
+ for (let i = 0; i < hostEndingChars.length; i++) {
118
+ hec = rest.indexOf(hostEndingChars[i])
119
+ if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
120
+ hostEnd = hec
121
+ }
122
+ }
123
+
124
+ let auth, atSign
125
+ if (hostEnd === -1) {
126
+ atSign = rest.lastIndexOf('@')
127
+ } else {
128
+ atSign = rest.lastIndexOf('@', hostEnd)
129
+ }
130
+
131
+ if (atSign !== -1) {
132
+ auth = rest.slice(0, atSign)
133
+ rest = rest.slice(atSign + 1)
134
+ this.auth = auth
135
+ }
136
+
137
+ hostEnd = -1
138
+ for (let i = 0; i < nonHostChars.length; i++) {
139
+ hec = rest.indexOf(nonHostChars[i])
140
+ if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
141
+ hostEnd = hec
142
+ }
143
+ }
144
+ if (hostEnd === -1) {
145
+ hostEnd = rest.length
146
+ }
147
+
148
+ if (rest[hostEnd - 1] === ':') { hostEnd-- }
149
+ const host = rest.slice(0, hostEnd)
150
+ rest = rest.slice(hostEnd)
151
+
152
+ this.parseHost(host)
153
+
154
+ this.hostname = this.hostname || ''
155
+
156
+ const ipv6Hostname = this.hostname[0] === '[' &&
157
+ this.hostname[this.hostname.length - 1] === ']'
158
+
159
+ if (!ipv6Hostname) {
160
+ const hostparts = this.hostname.split(/\./)
161
+ for (let i = 0, l = hostparts.length; i < l; i++) {
162
+ const part = hostparts[i]
163
+ if (!part) { continue }
164
+ if (!part.match(hostnamePartPattern)) {
165
+ let newpart = ''
166
+ for (let j = 0, k = part.length; j < k; j++) {
167
+ if (part.charCodeAt(j) > 127) {
168
+ newpart += 'x'
169
+ } else {
170
+ newpart += part[j]
171
+ }
172
+ }
173
+ if (!newpart.match(hostnamePartPattern)) {
174
+ const validParts = hostparts.slice(0, i)
175
+ const notHost = hostparts.slice(i + 1)
176
+ const bit = part.match(hostnamePartStart)
177
+ if (bit) {
178
+ validParts.push(bit[1])
179
+ notHost.unshift(bit[2])
180
+ }
181
+ if (notHost.length) {
182
+ rest = notHost.join('.') + rest
183
+ }
184
+ this.hostname = validParts.join('.')
185
+ break
186
+ }
187
+ }
188
+ }
189
+ }
190
+
191
+ if (this.hostname.length > hostnameMaxLen) {
192
+ this.hostname = ''
193
+ }
194
+
195
+ if (ipv6Hostname) {
196
+ this.hostname = this.hostname.substr(1, this.hostname.length - 2)
197
+ }
198
+ }
199
+
200
+ const hash = rest.indexOf('#')
201
+ if (hash !== -1) {
202
+ this.hash = rest.substr(hash)
203
+ rest = rest.slice(0, hash)
204
+ }
205
+ const qm = rest.indexOf('?')
206
+ if (qm !== -1) {
207
+ this.search = rest.substr(qm)
208
+ rest = rest.slice(0, qm)
209
+ }
210
+ if (rest) { this.pathname = rest }
211
+ if (slashedProtocol[lowerProto] &&
212
+ this.hostname && !this.pathname) {
213
+ this.pathname = ''
214
+ }
215
+
216
+ return this
217
+ }
218
+
219
+ Url.prototype.parseHost = function (host) {
220
+ let port = portPattern.exec(host)
221
+ if (port) {
222
+ port = port[0]
223
+ if (port !== ':') {
224
+ this.port = port.substr(1)
225
+ }
226
+ host = host.substr(0, host.length - port.length)
227
+ }
228
+ if (host) { this.hostname = host }
229
+ }
230
+
231
+ export default urlParse