@xiee/utils 1.2.8 → 1.2.9

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/README.md CHANGED
@@ -75,7 +75,8 @@ attributes.
75
75
  Find keyboard keys in `<code></code>` and convert the tag to `<kbd></kbd>`,
76
76
  e.g., convert `<code>Ctrl + C</code>` to `<kbd>Ctrl</kbd>` + `<kbd>C</kbd>`.
77
77
  With `key-buttons.css`, the keys will be styled as boxes with shadows like
78
- buttons.
78
+ buttons. You can learn more details [in this
79
+ post](https://yihui.org/en/2023/02/key-buttons/).
79
80
 
80
81
  ## load-highlight.js
81
82
 
@@ -1,30 +1,8 @@
1
1
  (function(d) {
2
- function fix_footnote(tagName) {
3
- let tags = d.getElementsByTagName(tagName), i, tag, tag2, n = 1, href;
4
- for (i = 0; i < tags.length; i++) {
5
- tag = tags[i];
6
- if (tagName === 'sup') {
7
- if (tag.className !== 'footnote-ref' || tag.id !== 'fnref:-') continue;
8
- tag.id += n;
9
- if (tag.children.length === 1) {
10
- tag2 = tag.children[0];
11
- href = tag2.getAttribute('href');
12
- if (tag2.nodeName === 'A' && href === '#fn:-') {
13
- tag2.setAttribute('href', href + n);
14
- }
15
- }
16
- } else if (tagName === 'li') {
17
- if (tag.id !== 'fn:-') continue;
18
- tag.id += n;
19
- tag2 = tag.lastChild; href = tag2.getAttribute('href');
20
- if (tag2.nodeName === 'A' && href === '#fnref:-') {
21
- tag2.setAttribute('href', href + n);
22
- }
23
- }
24
- n++;
25
- }
26
- }
27
- fix_footnote('sup'); fix_footnote('li');
2
+ // add [] to footnote numbers
3
+ d.querySelectorAll('sup[id^="fnref:"] > a.footnote-ref, a.footnote-ref > sup').forEach(el => {
4
+ if (/^[0-9]+$/.test(el.innerText)) el.innerText = ' [' + el.innerText + ']';
5
+ });
28
6
  // move the return symbol into the previous <p>
29
7
  d.querySelectorAll('.footnotes > ol > li > p ~ .footnote-return').forEach(el => {
30
8
  el.previousElementSibling.lastChild.after(el);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiee/utils",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "description": "Miscellaneous tools and utilities to manipulate HTML pages",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"