diff --git a/lib/get-macro-options/index.js b/lib/get-macro-options/index.js index 11416873c4..2d72d9fac6 100644 --- a/lib/get-macro-options/index.js +++ b/lib/get-macro-options/index.js @@ -1,7 +1,6 @@ const { dirname, join } = require('path') -const { marked } = require('marked') -const slugger = require('slugger') +const { Slugger, marked } = require('marked') // Get reference to marked.js const renderer = new marked.Renderer() @@ -20,7 +19,7 @@ function addSlugs (option) { } // Add URL-safe slugs for hrefs and IDs - option.slug = slugger(option.name) + option.slug = new Slugger().slug(option.name) return option } diff --git a/lib/metalsmith.js b/lib/metalsmith.js index debdb3453e..2b6f3ae46a 100644 --- a/lib/metalsmith.js +++ b/lib/metalsmith.js @@ -8,9 +8,9 @@ const permalinks = require('@metalsmith/permalinks') // apply a permalink patter const postcss = require('@metalsmith/postcss') const sass = require('@metalsmith/sass') // convert Sass files to CSS using Dart Sass const { glob } = require('glob') // Match files using glob patterns +const { Slugger } = require('marked') // generate slugs from titles const Metalsmith = require('metalsmith') // static site generator const canonical = require('metalsmith-canonical') // add a canonical url property to pages -const slugger = require('slugger') // generate slugs from titles // Helpers and config const { paths, navigation: menuItems } = require('../config') @@ -60,7 +60,7 @@ const nunjucksOptions = { }, filters: { - slugger + slugify: (string) => new Slugger().slug(string) } } diff --git a/package-lock.json b/package-lock.json index d00b467ff1..a925f41d28 100644 --- a/package-lock.json +++ b/package-lock.json @@ -61,7 +61,6 @@ "serve-static": "^1.15.0", "sitemap": "^7.1.1", "slash": "^3.0.0", - "slugger": "^1.0.1", "standard": "^17.1.0", "stylelint": "^14.16.1", "stylelint-config-gds": "^0.3.0", @@ -13692,11 +13691,6 @@ "node": ">=8" } }, - "node_modules/slugger": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, "node_modules/slugify": { "version": "1.6.5", "resolved": "https://registry.npmjs.org/slugify/-/slugify-1.6.5.tgz", @@ -26144,10 +26138,6 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, - "slugger": { - "version": "1.0.1", - "dev": true - }, "slugify": { "version": "1.6.5", "resolved": "https://registry.npmjs.org/slugify/-/slugify-1.6.5.tgz", diff --git a/package.json b/package.json index 7f0c4a11de..5639be8e1f 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,6 @@ "serve-static": "^1.15.0", "sitemap": "^7.1.1", "slash": "^3.0.0", - "slugger": "^1.0.1", "standard": "^17.1.0", "stylelint": "^14.16.1", "stylelint-config-gds": "^0.3.0", diff --git a/views/partials/_example.njk b/views/partials/_example.njk index 83a0989550..b32b2b56bb 100644 --- a/views/partials/_example.njk +++ b/views/partials/_example.njk @@ -15,7 +15,7 @@ {% if params.id %} {% set exampleId = params.id %} {% else %} - {% set exampleId = (exampleTitle + " example") | slugger %} + {% set exampleId = (exampleTitle + " example") | slugify %} {% endif %} {% if params.open %}