@xiee/utils 1.12.25 → 1.12.27

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.
@@ -0,0 +1,8 @@
1
+ span[data-line-number]::before {
2
+ content: attr(data-line-number);
3
+ padding-right: .5em;
4
+ margin-right: 1em;
5
+ display: inline-block;
6
+ border-right: solid 1px;
7
+ color: #ccc;
8
+ }
@@ -0,0 +1,2 @@
1
+ span[data-line-number]:before{content:attr(data-line-number);color:#ccc;border-right:1px solid;margin-right:1em;padding-right:.5em;display:inline-block}
2
+ /*# sourceMappingURL=code-line-numbers.min.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"mappings":"AAAA","sources":["code-line-numbers.css"],"sourcesContent":["span[data-line-number]::before {\n content: attr(data-line-number);\n padding-right: .5em;\n margin-right: 1em;\n display: inline-block;\n border-right: solid 1px;\n color: #ccc;\n}\n"],"names":[]}
package/css/default.css CHANGED
@@ -13,10 +13,9 @@ ul:has(li > input[type="checkbox"]) { list-style: none; padding-left: 1em; }
13
13
  a { color: steelblue; }
14
14
  pre, img { max-width: 100%; }
15
15
  pre, pre:hover { white-space: pre-wrap; word-break: break-all; }
16
- pre code { display: block; }
17
- pre:not(.line-numbers) code { overflow-x: auto; }
16
+ pre code { display: block; padding: 1em; overflow-x: auto; }
18
17
  code { font-family: 'DejaVu Sans Mono', 'Droid Sans Mono', 'Lucida Console', Consolas, Monaco, monospace; }
19
- :not(pre) > code, code[class], .line-numbers, .box > div { background-color: #f8f8f8; }
18
+ :not(pre) > code, code[class], .box > div { background-color: #f8f8f8; }
20
19
  pre > code:not([class]), pre > .language-plain, .box { background-color: inherit; border: 1px solid #eee; }
21
20
  pre > .message { border-color: #9eeaf9; }
22
21
  pre > .warning { background: #fff3cd; border-color: #fff3cd; }
@@ -28,18 +27,13 @@ pre > .error { background: #f8d7da; border-color: #f8d7da; }
28
27
  border-left: 2px solid;
29
28
  &:hover { opacity: inherit; }
30
29
  }
31
- pre[class*=language-].line-numbers {
32
- padding-top: 1em;
33
- padding-bottom: 1em;
34
- code { padding: initial; }
35
- }
36
30
  .box { margin: 1em 0; }
37
31
  .box > :first-child > p:first-child, .box > :last-child > p:last-child { padding: 1em; }
38
32
  .box > :first-child, .box > :first-child > p:first-child { margin-top: 0; }
39
33
  .box > :last-child, .box > :last-child > p:last-child { margin-bottom: 0; }
40
34
  .figure > p:has(img) { text-align: center; }
41
35
  table {
42
- margin: auto; border-top: 1px solid #666;
36
+ margin: auto; border-top: 1px solid #666;
43
37
  thead th { border-bottom: 1px solid #ddd; }
44
38
  th, td { padding: 5px; }
45
39
  thead, tfoot, tr:nth-child(even) { background: #eee; }
@@ -66,7 +60,7 @@ table, .body h2 { border-bottom: 1px solid #666; }
66
60
  .cross-ref-fig::before, .ref-number-fig::before { content: "Figure "; }
67
61
  .cross-ref-tab::before, .ref-number-tab::before { content: "Table "; }
68
62
  .footnote-ref a {
69
- &::before { content: "["; }
63
+ &::before { content: "["; }
70
64
  &::after { content: "]"; }
71
65
  }
72
66
  section.footnotes {
@@ -79,5 +73,5 @@ section.footnotes {
79
73
  tr, img { page-break-inside: avoid; }
80
74
  }
81
75
  @media only screen and (min-width: 992px) {
82
- pre:not(.line-numbers) { white-space: pre; }
76
+ pre { white-space: pre; }
83
77
  }
@@ -1,2 +1,2 @@
1
- body{box-sizing:border-box;max-width:800px;margin:auto;padding:1em;font-family:sans-serif;line-height:1.5}body,.footnotes,code{font-size:.9em}li li{font-size:.95em}ul:has(li>input[type=checkbox]){padding-left:1em;list-style:none}*,:before,:after{box-sizing:inherit}a{color:#4682b4}pre,img{max-width:100%}pre,pre:hover{white-space:pre-wrap;word-break:break-all}pre code{display:block}pre:not(.line-numbers) code{overflow-x:auto}code{font-family:DejaVu Sans Mono,Droid Sans Mono,Lucida Console,Consolas,Monaco,monospace}:not(pre)>code,code[class],.line-numbers,.box>div{background-color:#f8f8f8}pre>code:not([class]),pre>.language-plain,.box{background-color:inherit;border:1px solid #eee}pre>.message{border-color:#9eeaf9}pre>.warning{background:#fff3cd;border-color:#fff3cd}pre>.error{background:#f8d7da;border-color:#f8d7da}.fenced-chunk{border-left:1px solid #666}.code-fence{opacity:.4;border:1px dashed #666;border-left:2px solid;&:hover{opacity:inherit}}pre[class*=language-].line-numbers{padding-top:1em;padding-bottom:1em;& code{padding:initial}}.box{margin:1em 0}.box>:first-child>p:first-child,.box>:last-child>p:last-child{padding:1em}.box>:first-child,.box>:first-child>p:first-child{margin-top:0}.box>:last-child,.box>:last-child>p:last-child{margin-bottom:0}.figure>p:has(img){text-align:center}table{border-top:1px solid #666;margin:auto;& thead th{border-bottom:1px solid #ddd}& th,& td{padding:5px}& thead,& tfoot,& tr:nth-child(2n){background:#eee}}blockquote{color:#666;border-left:.5em solid #eee;margin:0;padding:1px 1em}hr,.footnotes:before{border:1px dashed #ddd}.frontmatter{text-align:center}#TOC .numbered{padding-left:0;& li{list-style:none}& ul{padding-left:1em}}table,.body h2{border-bottom:1px solid #666}.body .appendix,.appendix~h2{border-bottom-style:dashed}.main-number:after{content:"."}.ref-number-fig:after,.ref-number-tab:after{content:":"}.cross-ref-chp:before{content:"Chapter "}.cross-ref-sec:before{content:"Section "}.cross-ref-fig:before,.ref-number-fig:before{content:"Figure "}.cross-ref-tab:before,.ref-number-tab:before{content:"Table "}.footnote-ref a{&:before{content:"["}&:after{content:"]"}}section.footnotes{margin-top:2em;&:before{content:"";max-width:20em;display:block}}@media print{body{max-width:100%;font-size:12pt}tr,img{page-break-inside:avoid}}@media only screen and (width>=992px){pre:not(.line-numbers){white-space:pre}}
1
+ body{box-sizing:border-box;max-width:800px;margin:auto;padding:1em;font-family:sans-serif;line-height:1.5}body,.footnotes,code{font-size:.9em}li li{font-size:.95em}ul:has(li>input[type=checkbox]){padding-left:1em;list-style:none}*,:before,:after{box-sizing:inherit}a{color:#4682b4}pre,img{max-width:100%}pre,pre:hover{white-space:pre-wrap;word-break:break-all}pre code{padding:1em;display:block;overflow-x:auto}code{font-family:DejaVu Sans Mono,Droid Sans Mono,Lucida Console,Consolas,Monaco,monospace}:not(pre)>code,code[class],.box>div{background-color:#f8f8f8}pre>code:not([class]),pre>.language-plain,.box{background-color:inherit;border:1px solid #eee}pre>.message{border-color:#9eeaf9}pre>.warning{background:#fff3cd;border-color:#fff3cd}pre>.error{background:#f8d7da;border-color:#f8d7da}.fenced-chunk{border-left:1px solid #666}.code-fence{opacity:.4;border:1px dashed #666;border-left:2px solid;&:hover{opacity:inherit}}.box{margin:1em 0}.box>:first-child>p:first-child,.box>:last-child>p:last-child{padding:1em}.box>:first-child,.box>:first-child>p:first-child{margin-top:0}.box>:last-child,.box>:last-child>p:last-child{margin-bottom:0}.figure>p:has(img){text-align:center}table{border-top:1px solid #666;margin:auto;& thead th{border-bottom:1px solid #ddd}& th,& td{padding:5px}& thead,& tfoot,& tr:nth-child(2n){background:#eee}}blockquote{color:#666;border-left:.5em solid #eee;margin:0;padding:1px 1em}hr,.footnotes:before{border:1px dashed #ddd}.frontmatter{text-align:center}#TOC .numbered{padding-left:0;& li{list-style:none}& ul{padding-left:1em}}table,.body h2{border-bottom:1px solid #666}.body .appendix,.appendix~h2{border-bottom-style:dashed}.main-number:after{content:"."}.ref-number-fig:after,.ref-number-tab:after{content:":"}.cross-ref-chp:before{content:"Chapter "}.cross-ref-sec:before{content:"Section "}.cross-ref-fig:before,.ref-number-fig:before{content:"Figure "}.cross-ref-tab:before,.ref-number-tab:before{content:"Table "}.footnote-ref a{&:before{content:"["}&:after{content:"]"}}section.footnotes{margin-top:2em;&:before{content:"";max-width:20em;display:block}}@media print{body{max-width:100%;font-size:12pt}tr,img{page-break-inside:avoid}}@media only screen and (width>=992px){pre{white-space:pre}}
2
2
  /*# sourceMappingURL=default.min.css.map */
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,0GAQA,oCACA,sBACA,iEACA,oCACA,gBACA,uBACA,wDACA,uBACA,4CACA,2FACA,2EACA,8FACA,kCACA,qDACA,mDACA,yCACA,oEAIE,yBAEF,sEAGE,wBAEF,kBACA,0EACA,+DACA,+DACA,qCACA,4CAEE,wCACA,sBACA,oDAEF,2EAMA,4CACA,+BACA,8BAEE,qBACA,uBAEF,4CACA,wDACA,+BACA,wDACA,yCACA,yCACA,+DACA,8DACA,gBACE,qBACA,qBAEF,iCAEE,kDAGF,aACE,mCACA,gCAEF,sCACE","sources":["default.css"],"sourcesContent":["body {\n font-family: sans-serif;\n max-width: 800px;\n margin: auto;\n padding: 1em;\n line-height: 1.5;\n box-sizing: border-box;\n}\nbody, .footnotes, code { font-size: .9em; }\nli li { font-size: .95em; }\nul:has(li > input[type=\"checkbox\"]) { list-style: none; padding-left: 1em; }\n*, *:before, *:after { box-sizing: inherit; }\na { color: steelblue; }\npre, img { max-width: 100%; }\npre, pre:hover { white-space: pre-wrap; word-break: break-all; }\npre code { display: block; }\npre:not(.line-numbers) code { overflow-x: auto; }\ncode { font-family: 'DejaVu Sans Mono', 'Droid Sans Mono', 'Lucida Console', Consolas, Monaco, monospace; }\n:not(pre) > code, code[class], .line-numbers, .box > div { background-color: #f8f8f8; }\npre > code:not([class]), pre > .language-plain, .box { background-color: inherit; border: 1px solid #eee; }\npre > .message { border-color: #9eeaf9; }\npre > .warning { background: #fff3cd; border-color: #fff3cd; }\npre > .error { background: #f8d7da; border-color: #f8d7da; }\n.fenced-chunk { border-left: 1px solid #666; }\n.code-fence {\n opacity: .4;\n border: 1px dashed #666;\n border-left: 2px solid;\n &:hover { opacity: inherit; }\n}\npre[class*=language-].line-numbers {\n padding-top: 1em;\n padding-bottom: 1em;\n code { padding: initial; }\n}\n.box { margin: 1em 0; }\n.box > :first-child > p:first-child, .box > :last-child > p:last-child { padding: 1em; }\n.box > :first-child, .box > :first-child > p:first-child { margin-top: 0; }\n.box > :last-child, .box > :last-child > p:last-child { margin-bottom: 0; }\n.figure > p:has(img) { text-align: center; }\ntable {\n margin: auto; border-top: 1px solid #666; \n thead th { border-bottom: 1px solid #ddd; }\n th, td { padding: 5px; }\n thead, tfoot, tr:nth-child(even) { background: #eee; }\n}\nblockquote {\n color: #666;\n margin: 0;\n padding: 1px 1em;\n border-left: .5em solid #eee;\n}\nhr, .footnotes::before { border: 1px dashed #ddd; }\n.frontmatter { text-align: center; }\n#TOC .numbered {\n padding-left: 0;\n li { list-style: none; }\n ul { padding-left: 1em; }\n}\ntable, .body h2 { border-bottom: 1px solid #666; }\n.body .appendix, .appendix ~ h2 { border-bottom-style: dashed; }\n.main-number::after { content: \".\"; }\n.ref-number-fig::after, .ref-number-tab::after { content: \":\"; }\n.cross-ref-chp::before { content: \"Chapter \"; }\n.cross-ref-sec::before { content: \"Section \"; }\n.cross-ref-fig::before, .ref-number-fig::before { content: \"Figure \"; }\n.cross-ref-tab::before, .ref-number-tab::before { content: \"Table \"; }\n.footnote-ref a {\n &::before { content: \"[\"; } \n &::after { content: \"]\"; }\n}\nsection.footnotes {\n margin-top: 2em;\n &::before { content: \"\"; display: block; max-width: 20em; }\n}\n\n@media print {\n body { font-size: 12pt; max-width: 100%; }\n tr, img { page-break-inside: avoid; }\n}\n@media only screen and (min-width: 992px) {\n pre:not(.line-numbers) { white-space: pre; }\n}\n"],"names":[]}
1
+ {"version":3,"mappings":"AAAA,0GAQA,oCACA,sBACA,iEACA,oCACA,gBACA,uBACA,wDACA,mDACA,2FACA,6DACA,8FACA,kCACA,qDACA,mDACA,yCACA,oEAIE,yBAEF,kBACA,0EACA,+DACA,+DACA,qCACA,4CAEE,wCACA,sBACA,oDAEF,2EAMA,4CACA,+BACA,8BAEE,qBACA,uBAEF,4CACA,wDACA,+BACA,wDACA,yCACA,yCACA,+DACA,8DACA,gBACE,qBACA,qBAEF,iCAEE,kDAGF,aACE,mCACA,gCAEF,sCACE","sources":["default.css"],"sourcesContent":["body {\n font-family: sans-serif;\n max-width: 800px;\n margin: auto;\n padding: 1em;\n line-height: 1.5;\n box-sizing: border-box;\n}\nbody, .footnotes, code { font-size: .9em; }\nli li { font-size: .95em; }\nul:has(li > input[type=\"checkbox\"]) { list-style: none; padding-left: 1em; }\n*, *:before, *:after { box-sizing: inherit; }\na { color: steelblue; }\npre, img { max-width: 100%; }\npre, pre:hover { white-space: pre-wrap; word-break: break-all; }\npre code { display: block; padding: 1em; overflow-x: auto; }\ncode { font-family: 'DejaVu Sans Mono', 'Droid Sans Mono', 'Lucida Console', Consolas, Monaco, monospace; }\n:not(pre) > code, code[class], .box > div { background-color: #f8f8f8; }\npre > code:not([class]), pre > .language-plain, .box { background-color: inherit; border: 1px solid #eee; }\npre > .message { border-color: #9eeaf9; }\npre > .warning { background: #fff3cd; border-color: #fff3cd; }\npre > .error { background: #f8d7da; border-color: #f8d7da; }\n.fenced-chunk { border-left: 1px solid #666; }\n.code-fence {\n opacity: .4;\n border: 1px dashed #666;\n border-left: 2px solid;\n &:hover { opacity: inherit; }\n}\n.box { margin: 1em 0; }\n.box > :first-child > p:first-child, .box > :last-child > p:last-child { padding: 1em; }\n.box > :first-child, .box > :first-child > p:first-child { margin-top: 0; }\n.box > :last-child, .box > :last-child > p:last-child { margin-bottom: 0; }\n.figure > p:has(img) { text-align: center; }\ntable {\n margin: auto; border-top: 1px solid #666;\n thead th { border-bottom: 1px solid #ddd; }\n th, td { padding: 5px; }\n thead, tfoot, tr:nth-child(even) { background: #eee; }\n}\nblockquote {\n color: #666;\n margin: 0;\n padding: 1px 1em;\n border-left: .5em solid #eee;\n}\nhr, .footnotes::before { border: 1px dashed #ddd; }\n.frontmatter { text-align: center; }\n#TOC .numbered {\n padding-left: 0;\n li { list-style: none; }\n ul { padding-left: 1em; }\n}\ntable, .body h2 { border-bottom: 1px solid #666; }\n.body .appendix, .appendix ~ h2 { border-bottom-style: dashed; }\n.main-number::after { content: \".\"; }\n.ref-number-fig::after, .ref-number-tab::after { content: \":\"; }\n.cross-ref-chp::before { content: \"Chapter \"; }\n.cross-ref-sec::before { content: \"Section \"; }\n.cross-ref-fig::before, .ref-number-fig::before { content: \"Figure \"; }\n.cross-ref-tab::before, .ref-number-tab::before { content: \"Table \"; }\n.footnote-ref a {\n &::before { content: \"[\"; }\n &::after { content: \"]\"; }\n}\nsection.footnotes {\n margin-top: 2em;\n &::before { content: \"\"; display: block; max-width: 20em; }\n}\n\n@media print {\n body { font-size: 12pt; max-width: 100%; }\n tr, img { page-break-inside: avoid; }\n}\n@media only screen and (min-width: 992px) {\n pre { white-space: pre; }\n}\n"],"names":[]}
@@ -1,63 +1,18 @@
1
1
  /**
2
2
  * Prism.s theme ported from highlight.js's xcode style
3
3
  */
4
- pre code {
5
- padding: 1em;
6
- }
7
- .token.comment {
8
- color: #007400;
9
- }
10
- .token.punctuation {
11
- color: #999;
12
- }
13
- .token.tag,
14
- .token.selector {
15
- color: #aa0d91;
16
- }
17
- .token.boolean,
18
- .token.number,
19
- .token.constant,
20
- .token.symbol {
21
- color: #1c00cf;
22
- }
23
- .token.property,
24
- .token.attr-name,
25
- .token.string,
26
- .token.char,
27
- .token.builtin {
28
- color: #c41a16;
29
- }
30
- .token.inserted {
31
- background-color: #ccffd8;
32
- }
33
- .token.deleted {
34
- background-color: #ffebe9;
35
- }
36
- .token.operator,
37
- .token.entity,
38
- .token.url,
39
- .language-css .token.string,
40
- .style .token.string {
41
- color: #9a6e3a;
42
- }
43
- .token.atrule,
44
- .token.attr-value,
45
- .token.keyword {
46
- color: #836c28;
47
- }
48
- .token.function,
49
- .token.class-name {
50
- color: #DD4A68;
51
- }
52
- .token.regex,
53
- .token.important,
54
- .token.variable {
55
- color: #5c2699;
56
- }
57
- .token.important,
58
- .token.bold {
59
- font-weight: bold;
60
- }
61
- .token.italic {
62
- font-style: italic;
4
+ .token {
5
+ &.comment { color: #007400; }
6
+ &.punctuation { color: #999; }
7
+ &.tag, &.selector { color: #aa0d91; }
8
+ &.boolean, &.number, &.constant, &.symbol { color: #1c00cf; }
9
+ &.property, &.attr-name, &.string, &.char, &.builtin { color: #c41a16; }
10
+ &.inserted { background-color: #ccffd8; }
11
+ &.deleted { background-color: #ffebe9; }
12
+ &.operator, &.entity, &.url, .language-css &.string, .style &.string { color: #9a6e3a; }
13
+ &.atrule, &.attr-value, &.keyword { color: #836c28; }
14
+ &.function, &.class-name { color: #DD4A68; }
15
+ &.regex, &.important, &.variable { color: #5c2699; }
16
+ &.important, &.bold { font-weight: bold; }
17
+ &.italic { font-style: italic; }
63
18
  }
@@ -1,2 +1,2 @@
1
- pre code{padding:1em}.token.comment{color:#007400}.token.punctuation{color:#999}.token.tag,.token.selector{color:#aa0d91}.token.boolean,.token.number,.token.constant,.token.symbol{color:#1c00cf}.token.property,.token.attr-name,.token.string,.token.char,.token.builtin{color:#c41a16}.token.inserted{background-color:#ccffd8}.token.deleted{background-color:#ffebe9}.token.operator,.token.entity,.token.url,.language-css .token.string,.style .token.string{color:#9a6e3a}.token.atrule,.token.attr-value,.token.keyword{color:#836c28}.token.function,.token.class-name{color:#dd4a68}.token.regex,.token.important,.token.variable{color:#5c2699}.token.important,.token.bold{font-weight:700}.token.italic{font-style:italic}
1
+ .token{&.comment{color:#007400}&.punctuation{color:#999}&.tag,&.selector{color:#aa0d91}&.boolean,&.number,&.constant,&.symbol{color:#1c00cf}&.property,&.attr-name,&.string,&.char,&.builtin{color:#c41a16}&.inserted{background-color:#ccffd8}&.deleted{background-color:#ffebe9}&.operator,&.entity,&.url,.language-css &.string,.style &.string{color:#9a6e3a}&.atrule,&.attr-value,&.keyword{color:#836c28}&.function,&.class-name{color:#dd4a68}&.regex,&.important,&.variable{color:#5c2699}&.important,&.bold{font-weight:700}&.italic{font-style:italic}}
2
2
  /*# sourceMappingURL=prism-xcode.min.css.map */
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAGA,qBAGA,6BAGA,8BAGA,yCAIA,yEAMA,wFAOA,yCAGA,wCAGA,wGAOA,6DAKA,gDAIA,4DAKA,6CAIA","sources":["prism-xcode.css"],"sourcesContent":["/**\n * Prism.s theme ported from highlight.js's xcode style\n */\npre code {\n padding: 1em;\n}\n.token.comment {\n color: #007400;\n}\n.token.punctuation {\n color: #999;\n}\n.token.tag,\n.token.selector {\n color: #aa0d91;\n}\n.token.boolean,\n.token.number,\n.token.constant,\n.token.symbol {\n color: #1c00cf;\n}\n.token.property,\n.token.attr-name,\n.token.string,\n.token.char,\n.token.builtin {\n color: #c41a16;\n}\n.token.inserted {\n background-color: #ccffd8;\n}\n.token.deleted {\n background-color: #ffebe9;\n}\n.token.operator,\n.token.entity,\n.token.url,\n.language-css .token.string,\n.style .token.string {\n color: #9a6e3a;\n}\n.token.atrule,\n.token.attr-value,\n.token.keyword {\n color: #836c28;\n}\n.token.function,\n.token.class-name {\n color: #DD4A68;\n}\n.token.regex,\n.token.important,\n.token.variable {\n color: #5c2699;\n}\n.token.important,\n.token.bold {\n font-weight: bold;\n}\n.token.italic {\n font-style: italic;\n}\n"],"names":[]}
1
+ {"version":3,"mappings":"AAGA,OACE,wBACA,yBACA,+BACA,qDACA,+DACA,oCACA,mCACA,+EACA,8CACA,sCACA,6CACA,mCACA","sources":["prism-xcode.css"],"sourcesContent":["/**\n * Prism.s theme ported from highlight.js's xcode style\n */\n.token {\n &.comment { color: #007400; }\n &.punctuation { color: #999; }\n &.tag, &.selector { color: #aa0d91; }\n &.boolean, &.number, &.constant, &.symbol { color: #1c00cf; }\n &.property, &.attr-name, &.string, &.char, &.builtin { color: #c41a16; }\n &.inserted { background-color: #ccffd8; }\n &.deleted { background-color: #ffebe9; }\n &.operator, &.entity, &.url, .language-css &.string, .style &.string { color: #9a6e3a; }\n &.atrule, &.attr-value, &.keyword { color: #836c28; }\n &.function, &.class-name { color: #DD4A68; }\n &.regex, &.important, &.variable { color: #5c2699; }\n &.important, &.bold { font-weight: bold; }\n &.italic { font-style: italic; }\n}\n"],"names":[]}
@@ -0,0 +1,21 @@
1
+ // add line numbers to code blocks for <code class="line-numbers" [data-start=*]>
2
+ (() => {
3
+ function addNum(el) {
4
+ const s = '<span data-line-number=""></span>', sel = 'span[data-line-number]';
5
+ if (!el.classList.contains('line-numbers') || el.parentNode.tagName !== 'PRE'
6
+ || el.querySelector(sel)) return;
7
+ el.innerHTML = s + el.innerHTML.replace(/(\n)(.|\s)/g, '$1' + s + '$2');
8
+ let n1 = +el.dataset.start; if (isNaN(n1)) n1 = 1;
9
+ const spans = el.querySelectorAll(sel), w = ('' + (n1 - 1 + spans.length)).length;
10
+ spans.forEach(sp => {
11
+ let n = '' + (n1++), d = w - n.length;
12
+ if (d > 0) n = '0'.repeat(d) + n;
13
+ sp.dataset.lineNumber = n;
14
+ });
15
+ }
16
+ function addAll(e) {
17
+ e ? (e.grammar && addNum(e.element)) :
18
+ document.querySelectorAll('pre > code.line-numbers:first-child').forEach(addNum);
19
+ }
20
+ window.Prism?.hooks ? Prism.hooks.add('complete', addAll) : addAll();
21
+ })();
@@ -0,0 +1 @@
1
+ (()=>{function e(e){const n='<span data-line-number=""></span>',t="span[data-line-number]";if(!e.classList.contains("line-numbers")||"PRE"!==e.parentNode.tagName||e.querySelector(t))return;e.innerHTML=n+e.innerHTML.replace(/(\n)(.|\s)/g,"$1"+n+"$2");let r=+e.dataset.start;isNaN(r)&&(r=1);const a=e.querySelectorAll(t),l=(""+(r-1+a.length)).length;a.forEach((e=>{let n=""+r++,t=l-n.length;t>0&&(n="0".repeat(t)+n),e.dataset.lineNumber=n}))}function n(n){n?n.grammar&&e(n.element):document.querySelectorAll("pre > code.line-numbers:first-child").forEach(e)}window.Prism?.hooks?Prism.hooks.add("complete",n):n()})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiee/utils",
3
- "version": "1.12.25",
3
+ "version": "1.12.27",
4
4
  "description": "Miscellaneous tools and utilities to manipulate HTML pages",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"