1.14.11 • Published 12 months ago

@xiee/utils v1.14.11

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

jsdelivr
badge

This repo contains miscellaneous lightweight tools and utilities written in JavaScript. They are published as an NPM package @xiee/utils. You can load them via jsdelivr.com, e.g.,

<script src="https://cdn.jsdelivr.net/npm/@xiee/utils/js/faq.min.js" defer></script>
<link href="https://cdn.jsdelivr.net/npm/@xiee/utils/css/faq.min.css" rel="stylesheet">

See the full documentation at https://yihui.org/en/2018/11/md-js-tricks/.

alt-title.js

Add the title attribute to <img> if the attribute does not exist. The value of the attribute is taken from the alt attribute. It modifies

<img src="foo.png" alt="an image" />

to

<img src="foo.png" alt="an image" title="an image" />

Then the image will have a tooltip on mouseover.

center-img.js

Center <img>, <video>, and <object> on a page if they are the only child of their parent element.

code-lang.js

Add the language- prefix to the class name of <code> inside <pre> when appropriate, so that syntax highlighters such as prism.js can work.

copy-button.js

Add a copy button to any element (by default, <pre> code blocks) on a page. See this post for details.

dl-fieldset.js

Convert definition lists <dl> to <fieldset>. See more information in this post.

docco-classic.js

Find code blocks on a page and put them in the right column. Other elements will be placed in the left column.

external-link.js

If a link of <a> does not start with http:// or https://, add the attribute target="_blank" to <a> so it opens in a new tab/window.

faq.js

Turn an ordered list on an HTML page into a collapsible FAQ list. Click on any question to toggle the visibility of its answer. Or click on the button at the top-right to expand or collapse all answers. Each FAQ item has an anchor (shown as the # symbol at the end on mouseover) that provides the link to the specific question.

Note that you will need to load faq.css accordingly. See a more detailed introduction here.

fix-footnote.js

Add [ ] to footnote numbers and move the return symbols in footnotes.

fix-toc.js

Fix the table of contents generated by lower versions of Hugo.

fold-details.js

Move elements into <details> so that they can be folded. By default, code blocks (<pre>) are folded. Other elements can also be folded via custom options. See this post for more information.

fold-output.js

Click on a code block of the class language-* to toggle the visibility of its siblings on the page before the next language-* block. Click while holding the Alt key to toggle siblings of all language-* blocks on the page.

fullwidth.js

Find <pre>, <table>, and TOC (with ID TableOfContents) elements and add the fullwidth class to them if they are too wide, so they can be styled differently (e.g., full bleed).

fuse-search.js

Perform client-side site searching via Fuse.js. See this post for an application to Hugo sites.

hash-notes.js

Convert HTML comments of the form <!--# comments --> to <span class="hash-note">comments</span>. If such comments are found, the document body will gain classes has-notes and hide-notes. You can use CSS to style the notes or hide/show them as you wish.

heading-anchor.js

Add anchor links to all section headings (e.g., <h2>) that have nonempty id attributes.

key-buttons.js

Find keyboard keys in <code></code> and convert the tag to <kbd></kbd>, e.g., convert <code>Ctrl + C</code> to <kbd>Ctrl</kbd> + <kbd>C</kbd>. With key-buttons.css, the keys will be styled as boxes with shadows like buttons. You can learn more details in this post.

load-highlight.js

Disable highlight.js's auto language detection, and then apply highlighting. This requires highlight.js to be loaded in advance.

math-code.js

Write LaTeX math expressions ($\alpha$) in <code></code> in HTML or a pair of backticks in Markdown (which will be rendered to <code> in HTML), and this script will remove the <code> tag, so that MathJax can recognize the math expressions (by default, MathJax ignores math in <code>).

no-highlight.js

Add the nohighlight class to <code> in <pre> when it does not have a class, so that highlight.js will not try to syntax highlight the code in it.

number-captions.js

Number figure and table captions.

number-sections.js

Find all section headings (h1 - h6) and number them.

ol-id.js

Add IDs of the form li-N to items in ordered lists, where N is the index of a list item. This makes it possible to reference or locate a specific item on a page by a hash in the URL. If you hold Alt and click on an item, you will get the URL with the hash in the address bar of your browser.

render-katex.js

Simply run renderMathInElement(document.body) to render math expression using KaTeX's auto-render extension.

right-quote.js

Right-align a <blockquote> footer if the footer is a <p> that starts with the em-dash.

snap.js

Create HTML slides using the CSS Scroll Snap technique.

tabsets.js

Create tabsets from section headings and their content. See this post for documentation.

toc.js

Automatically build a table of contents (TOC) from all section headings.

toc-highlight.js

Add a class active to the TOC item (<a>) corresponding to the section heading that is currently being scrolled into view.

1.14.11

12 months ago

1.14.9

1 year ago

1.14.8

1 year ago

1.14.10

1 year ago

1.14.7

1 year ago

1.14.5

1 year ago

1.14.4

1 year ago

1.14.6

1 year ago

1.13.71

1 year ago

1.13.70

1 year ago

1.14.1

1 year ago

1.14.0

1 year ago

1.14.3

1 year ago

1.14.2

1 year ago

1.13.68

1 year ago

1.13.69

1 year ago

1.13.66

1 year ago

1.13.65

1 year ago

1.13.67

1 year ago

1.13.64

1 year ago

1.13.63

1 year ago

1.13.62

1 year ago

1.13.61

1 year ago

1.13.60

1 year ago

1.13.57

1 year ago

1.13.59

1 year ago

1.13.58

1 year ago

1.13.53

1 year ago

1.13.52

1 year ago

1.13.55

1 year ago

1.13.54

1 year ago

1.13.51

1 year ago

1.13.56

1 year ago

1.13.50

1 year ago

1.13.49

1 year ago

1.13.46

1 year ago

1.13.48

1 year ago

1.13.47

1 year ago

1.13.45

1 year ago

1.13.44

1 year ago

1.13.43

1 year ago

1.13.42

1 year ago

1.13.39

1 year ago

1.13.41

1 year ago

1.13.40

1 year ago

1.13.38

1 year ago

1.13.35

1 year ago

1.13.34

1 year ago

1.13.37

1 year ago

1.13.36

1 year ago

1.13.31

1 year ago

1.13.30

1 year ago

1.13.33

1 year ago

1.13.32

1 year ago

1.13.20

2 years ago

1.13.22

2 years ago

1.13.21

2 years ago

1.13.28

2 years ago

1.13.27

2 years ago

1.13.29

2 years ago

1.13.24

2 years ago

1.13.23

2 years ago

1.13.26

2 years ago

1.13.25

2 years ago

1.13.17

2 years ago

1.13.16

2 years ago

1.13.19

2 years ago

1.13.18

2 years ago

1.13.15

2 years ago

1.13.14

2 years ago

1.13.2

2 years ago

1.13.1

2 years ago

1.13.6

2 years ago

1.13.5

2 years ago

1.13.4

2 years ago

1.13.3

2 years ago

1.13.9

2 years ago

1.13.11

2 years ago

1.13.8

2 years ago

1.13.10

2 years ago

1.13.7

2 years ago

1.13.13

2 years ago

1.13.12

2 years ago

1.13.0

2 years ago

1.12.29

2 years ago

1.12.30

2 years ago

1.12.31

2 years ago

1.12.28

2 years ago

1.12.21

2 years ago

1.12.20

2 years ago

1.12.27

2 years ago

1.12.26

2 years ago

1.12.23

2 years ago

1.12.22

2 years ago

1.12.25

2 years ago

1.12.24

2 years ago

1.12.16

2 years ago

1.12.18

2 years ago

1.12.17

2 years ago

1.12.19

2 years ago

1.12.15

2 years ago

1.12.14

2 years ago

1.12.7

2 years ago

1.12.9

2 years ago

1.12.8

2 years ago

1.12.10

2 years ago

1.12.12

2 years ago

1.12.11

2 years ago

1.12.13

2 years ago

1.12.6

2 years ago

1.12.5

2 years ago

1.12.4

2 years ago

1.12.3

2 years ago

1.12.2

2 years ago

1.12.1

2 years ago

1.12.0

2 years ago

1.11.5

2 years ago

1.11.4

2 years ago

1.11.3

2 years ago

1.11.2

2 years ago

1.11.1

2 years ago

1.10.4

2 years ago

1.11.0

2 years ago

1.10.3

2 years ago

1.10.2

2 years ago

1.10.1

2 years ago

1.10.0

2 years ago

1.9.5

2 years ago

1.6.4

2 years ago

1.6.3

2 years ago

1.8.0

2 years ago

1.6.2

2 years ago

1.6.1

2 years ago

1.4.3

2 years ago

1.6.0

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.10

2 years ago

1.3.13

2 years ago

1.3.14

2 years ago

1.3.11

2 years ago

1.3.12

2 years ago

1.3.17

2 years ago

1.3.18

2 years ago

1.3.15

2 years ago

1.3.16

2 years ago

1.3.19

2 years ago

1.3.20

2 years ago

1.9.4

2 years ago

1.9.3

2 years ago

1.3.9

3 years ago

1.9.2

2 years ago

1.5.6

2 years ago

1.9.1

2 years ago

1.5.5

2 years ago

1.9.0

2 years ago

1.5.4

2 years ago

1.5.3

2 years ago

1.7.0

2 years ago

1.5.2

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.6.9

2 years ago

1.6.8

2 years ago

1.6.7

2 years ago

1.6.6

2 years ago

1.6.5

2 years ago

1.3.7

3 years ago

1.3.6

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.3.8

3 years ago

1.2.9

3 years ago

1.2.12

3 years ago

1.2.13

3 years ago

1.2.10

3 years ago

1.2.11

3 years ago

1.2.14

3 years ago

1.2.8

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.0

3 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.1.12

4 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.15

3 years ago

1.1.14

3 years ago

1.1.13

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago