From a3af08eb008d2ee015196db579c4e9ffccd0cd74 Mon Sep 17 00:00:00 2001 From: sandypockets Date: Sat, 16 Dec 2023 15:14:56 -0500 Subject: [PATCH] Fix: Nuxt example slug --- examples/nuxt-tailwind/buildMarkdown.js | 8 ++++++-- examples/nuxt-tailwind/package.json | 2 +- examples/nuxt-tailwind/pages/_slug.vue | 18 ------------------ examples/nuxt-tailwind/pages/blog/_slug.vue | 18 ++++++++++++++++++ examples/nuxt-tailwind/pages/index.vue | 10 +++++----- .../posts/{exmaple.md => example.md} | 0 examples/nuxt-tailwind/static/posts.json | 2 +- 7 files changed, 31 insertions(+), 27 deletions(-) delete mode 100644 examples/nuxt-tailwind/pages/_slug.vue create mode 100644 examples/nuxt-tailwind/pages/blog/_slug.vue rename examples/nuxt-tailwind/posts/{exmaple.md => example.md} (100%) diff --git a/examples/nuxt-tailwind/buildMarkdown.js b/examples/nuxt-tailwind/buildMarkdown.js index ab66f6b..acc4bd0 100644 --- a/examples/nuxt-tailwind/buildMarkdown.js +++ b/examples/nuxt-tailwind/buildMarkdown.js @@ -1,6 +1,6 @@ const fs = require('fs'); const path = require('path'); -const { processMarkdown } = require('epic-remark'); +const { processMarkdown } = require('epic-remark/dist/index'); const postsDirectory = path.join(__dirname, 'posts'); const outputDirectory = path.join(__dirname, 'static'); @@ -10,6 +10,7 @@ const processPosts = async () => { const posts = []; for (const fileName of fileNames) { + const id = fileName.replace(/\.md$/, ''); // Remove the file extension to get the ID const filePath = path.join(postsDirectory, fileName); const fileContents = fs.readFileSync(filePath, 'utf8'); const options = { @@ -23,7 +24,10 @@ const processPosts = async () => { renderEmbeds: true, } const processedContent = await processMarkdown(fileContents, options); - posts.push(processedContent); + posts.push({ + id, // Include the ID in the post object + ...processedContent + }); } if (!fs.existsSync(outputDirectory)){ diff --git a/examples/nuxt-tailwind/package.json b/examples/nuxt-tailwind/package.json index 9b66838..9fe0a98 100644 --- a/examples/nuxt-tailwind/package.json +++ b/examples/nuxt-tailwind/package.json @@ -10,7 +10,7 @@ }, "dependencies": { "core-js": "^3.25.3", - "epic-remark": "^0.1.7", + "epic-remark": "^0.1.11", "nuxt": "^2.15.8", "vue": "^2.7.10", "vue-server-renderer": "^2.7.10", diff --git a/examples/nuxt-tailwind/pages/_slug.vue b/examples/nuxt-tailwind/pages/_slug.vue deleted file mode 100644 index 518e1a5..0000000 --- a/examples/nuxt-tailwind/pages/_slug.vue +++ /dev/null @@ -1,18 +0,0 @@ - - - diff --git a/examples/nuxt-tailwind/pages/blog/_slug.vue b/examples/nuxt-tailwind/pages/blog/_slug.vue new file mode 100644 index 0000000..5f6b503 --- /dev/null +++ b/examples/nuxt-tailwind/pages/blog/_slug.vue @@ -0,0 +1,18 @@ + + + diff --git a/examples/nuxt-tailwind/pages/index.vue b/examples/nuxt-tailwind/pages/index.vue index 5bc355a..16a0635 100644 --- a/examples/nuxt-tailwind/pages/index.vue +++ b/examples/nuxt-tailwind/pages/index.vue @@ -1,14 +1,14 @@