Slugify plugin names used for urls (#5098)

This commit is contained in:
Robert Kaussow 2025-04-17 11:01:27 +02:00 committed by GitHub
parent 4a63043a42
commit 6d344c847b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 1 deletions

View file

@ -19,6 +19,7 @@
"concurrently": "^9.1.2",
"isomorphic-dompurify": "^2.19.0",
"marked": "^15.0.5",
"slugify": "^1.6.6",
"tslib": "^2.8.1",
"typescript": "^5.7.2"
},

View file

@ -2,6 +2,8 @@ import fs from 'fs';
import path from 'path';
import { LoadContext, Plugin, PluginContentLoadedActions } from '@docusaurus/types';
import axios, { AxiosError } from 'axios';
import slugify from 'slugify';
import * as markdown from './markdown';
import { Content, WoodpeckerPlugin, WoodpeckerPluginHeader, WoodpeckerPluginIndexEntry } from './types';
@ -90,7 +92,7 @@ async function contentLoaded({
const pluginJsonPath = await createData(`plugin-${i}.json`, JSON.stringify(plugin));
addRoute({
path: `/plugins/${plugin.name}`,
path: `/plugins/${slugify(plugin.name, { lower: true, strict: true })}`,
component: '@theme/WoodpeckerPlugin',
modules: {
plugin: pluginJsonPath,

View file

@ -109,6 +109,9 @@ importers:
marked:
specifier: ^15.0.5
version: 15.0.8
slugify:
specifier: ^1.6.6
version: 1.6.6
tslib:
specifier: ^2.8.1
version: 2.8.1
@ -5352,6 +5355,10 @@ packages:
resolution: {integrity: sha512-tf+h5W1IrjNm/9rKKj0JU2MDMruiopx0jjVA5zCdBtcGjfp0+c5rHw/zADLC3IeKlGHtVbHtpfzvYA0OYT+HKg==}
engines: {node: '>=8.0.0'}
slugify@1.6.6:
resolution: {integrity: sha512-h+z7HKHYXj6wJU+AnS/+IH8Uh9fdcX1Lrhg1/VMdf9PwoBQXFcXiAdsy2tSK0P6gKwJLXp02r90ahUCqHk9rrw==}
engines: {node: '>=8.0.0'}
snake-case@3.0.4:
resolution: {integrity: sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==}
@ -12737,6 +12744,8 @@ snapshots:
slugify@1.4.7: {}
slugify@1.6.6: {}
snake-case@3.0.4:
dependencies:
dot-case: 3.0.4