From cfd8078f56c0e3a59605f31daf8fe3aa2c434fd1 Mon Sep 17 00:00:00 2001 From: madcampos Date: Tue, 16 Jan 2024 00:43:43 -0500 Subject: [PATCH] feat: add plugin for soft breaks in markdown --- astro.config.ts | 6 +++++- package-lock.json | 30 ++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/astro.config.ts b/astro.config.ts index c48f7bf..595a775 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -1,7 +1,10 @@ import { readFileSync } from 'node:fs'; + import { defineConfig } from 'astro/config'; import astroPWA, { type PwaOptions } from '@vite-pwa/astro'; +import remarkBreaks from 'remark-breaks'; + const manifest: PwaOptions['manifest'] = JSON.parse(readFileSync('./src/manifest.json', { encoding: 'utf8' })); export default defineConfig({ @@ -20,7 +23,8 @@ export default defineConfig({ markdown: { shikiConfig: { theme: 'dark-plus' - } + }, + remarkPlugins: [remarkBreaks] }, integrations: [ astroPWA({ diff --git a/package-lock.json b/package-lock.json index 594b838..7579a15 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,6 +26,7 @@ "lint-staged": "^15.2.0", "marked": "^11.1.1", "postcss-html": "^1.6.0", + "remark-breaks": "^4.0.0", "stylelint": "^16.1.0", "stylelint-config-html": "^1.1.0", "typescript": "^5.3.3" @@ -8401,6 +8402,20 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/mdast-util-newline-to-break": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-newline-to-break/-/mdast-util-newline-to-break-2.0.0.tgz", + "integrity": "sha512-MbgeFca0hLYIEx/2zGsszCSEJJ1JSCdiY5xQxRcLDDGa8EPvlLPupJ4DSajbMPAnC0je8jfb9TiUATnxxrHUog==", + "dev": true, + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-find-and-replace": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/mdast-util-phrasing": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.0.0.tgz", @@ -10487,6 +10502,21 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/remark-breaks": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/remark-breaks/-/remark-breaks-4.0.0.tgz", + "integrity": "sha512-IjEjJOkH4FuJvHZVIW0QCDWxcG96kCq7An/KVH2NfJe6rKZU2AsHeB3OEjPNRxi4QC34Xdx7I2KGYn6IpT7gxQ==", + "dev": true, + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-newline-to-break": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/remark-gfm": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-4.0.0.tgz", diff --git a/package.json b/package.json index 85de9dc..c07cad3 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "lint-staged": "^15.2.0", "marked": "^11.1.1", "postcss-html": "^1.6.0", + "remark-breaks": "^4.0.0", "stylelint": "^16.1.0", "stylelint-config-html": "^1.1.0", "typescript": "^5.3.3"