Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@xiee/utils

Package Overview
Dependencies
Maintainers
1
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xiee/utils - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

21

js/fix-toc.js

@@ -0,5 +1,22 @@

// fix some issues in TOC generated by Hugo (Blackfriday or Goldmark)
(function() {
var toc = document.getElementById('TableOfContents');
const toc = document.getElementById('TableOfContents');
if (!toc) return;
var li, ul = toc.querySelector('ul');
// fix header ids and a hrefs if a header contains a link
toc.querySelectorAll('a[href^="#"]').forEach((a) => {
let id = a.getAttribute('href').replace(/^#/, '');
const h = document.getElementById(id);
// remove the URL from the id
id = id.replace(/-https?-.+$/, '');
if (h) h.id = id; a.href = '#' + id;
// if the TOC item has two <a>'s, remove the second if the first is empty
if (a.innerHTML !== '') return;
const a2 = a.nextElementSibling;
if (!a2 || a2.tagName !== 'A') return;
a.innerHTML = a2.innerHTML;
a2.remove();
});
// Blackfriday may generate a TOC that has an empty bullet when all headings
// are h2 and there is no h1: https://github.com/gohugoio/hugo/issues/1778#issuecomment-420036687
let li, ul = toc.querySelector('ul');
if (ul.childElementCount !== 1) return;

@@ -6,0 +23,0 @@ li = ul.firstElementChild;

2

package.json
{
"name": "@xiee/utils",
"version": "1.1.2",
"version": "1.1.3",
"description": "Miscellaneous tools and utilities to manipulate HTML pages",

@@ -5,0 +5,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc