diff --git a/.vitepress/config.mjs b/.vitepress/config.mjs index ee8c17e..4b069e5 100644 --- a/.vitepress/config.mjs +++ b/.vitepress/config.mjs @@ -4,6 +4,7 @@ export default { title: 'Pixel Services Docs', description: 'Documentation for all public Pixel Services projects.', siteTitle: 'Documentation for all public Pixel Services projects.', + ignoreDeadLinks: true, head: [ ['link', { rel: 'icon', href: 'https://static.pixel-services.com/static/assets/pservices_logo.png' }] diff --git a/flash/core-concepts/handlers.md b/flash/core-concepts/handlers.md index 3741b62..f7dc858 100644 --- a/flash/core-concepts/handlers.md +++ b/flash/core-concepts/handlers.md @@ -29,7 +29,9 @@ You can extend the `RequestHandler` class to create custom handlers that process Because `RequestHandler` is an abstract class, you need to implement both the `handle()` method and the `super` constructor in your custom handler to define the logic that should be executed when a request is received. -Since `RequestHandler` is an abstract class, you can leverage and chain HDI's to create cleaner and more maintainable route logic (more on that in the [Handler Default Implementations](/flash/advanced/handler-default-implementations) section). +Since `RequestHandler` is an abstract class, you can leverage and chain HDI's to create cleaner and more maintainable route logic (more on that in the Handler Default Implementations guide). + +```java[Example] ### 2. SimpleHandler diff --git a/flash/file-serving/dynamic-file-server.md b/flash/file-serving/dynamic-file-server.md index fb73ed9..00d1f1c 100644 --- a/flash/file-serving/dynamic-file-server.md +++ b/flash/file-serving/dynamic-file-server.md @@ -13,7 +13,7 @@ corresponding file from the server. This is where a dynamic file server comes in ::: warning The dynamic file server relies heavily on the concept of dynamic handlers, which are handlers that will resolve for -any subpath of the endpoint they are registered to (see [Handler Types](/flash/core-concepts/handlers) for more info). +any subpath of the endpoint they are registered to (see Handler Types for more info). ::: ## Usage diff --git a/scripts/banner-generator.cjs b/scripts/banner-generator.cjs index ef6863c..e35842f 100644 --- a/scripts/banner-generator.cjs +++ b/scripts/banner-generator.cjs @@ -6,11 +6,27 @@ const makeCard = require('twitter-card-image'); const projects = ['flash', 'mobot', 'serverlibraries']; const baseDir = path.resolve(__dirname, './'); const outputImageDir = path.resolve(__dirname, '../.vitepress/dist/assets/banner-cards/'); +const excludedFolders = ['assets', 'config', 'vitepress']; if (!fs.existsSync(outputImageDir)) { fs.mkdirSync(outputImageDir, { recursive: true }); } +const getMarkdownFiles = (dir) => { + let results = []; + const list = fs.readdirSync(dir); + list.forEach((file) => { + const filePath = path.join(dir, file); + const stat = fs.statSync(filePath); + if (stat && stat.isDirectory() && !excludedFolders.includes(file)) { + results = results.concat(getMarkdownFiles(filePath)); + } else if (file.endsWith('.md')) { + results.push(filePath); + } + }); + return results; +}; + const generateBannerCard = async (filePath, outputPath) => { try { const content = fs.readFileSync(filePath, 'utf-8'); @@ -73,7 +89,7 @@ const generateIndexImage = async () => { const generateImagesForProjects = async () => { await generateIndexImage(); - //handle all projects + // Handle all projects for (const project of projects) { const projectPath = path.join(baseDir, "../" + project); @@ -82,10 +98,10 @@ const generateImagesForProjects = async () => { continue; } - const files = fs.readdirSync(projectPath).filter((file) => file.endsWith('.md')); - for (const file of files) { - const filePath = path.join(projectPath, file); - const fileName = `${project}-${file.replace('.md', '')}.png`; + const files = getMarkdownFiles(projectPath); + for (const filePath of files) { + const relativePath = path.relative(projectPath, filePath); + const fileName = `${project}-${relativePath.replace(/[/\\]/g, '-')}.png`; const outputImagePath = path.join(outputImageDir, fileName); console.log(`Generating: ${fileName}`); await generateBannerCard(filePath, outputImagePath); @@ -95,4 +111,4 @@ const generateImagesForProjects = async () => { module.exports = { generateImagesForProjects, -}; +}; \ No newline at end of file