summaryrefslogtreecommitdiff
path: root/packages/markdown/remark/src
diff options
context:
space:
mode:
authorGravatar Ben Holmes <hey@bholmes.dev> 2022-06-16 20:31:08 -0400
committerGravatar GitHub <noreply@github.com> 2022-06-16 20:31:08 -0400
commitfca58cfd91b68501ec82350ab023170b208d8ce7 (patch)
tree443081239f72544fe56aea28f587a3ed54022ea4 /packages/markdown/remark/src
parentfb80e384e3fd8a45b73d5617f4859e7dfa48d2c3 (diff)
downloadastro-fca58cfd91b68501ec82350ab023170b208d8ce7.tar.gz
astro-fca58cfd91b68501ec82350ab023170b208d8ce7.tar.zst
astro-fca58cfd91b68501ec82350ab023170b208d8ce7.zip
Fix: Netlify edge deployment when using markdown (#3612)
* wip: revert sitemap PR * fix: extract SSR-ready "slug" helper to separate module * Un-revert sitemap PR. Not to blame! This reverts commit 7cd2a8a5ea1e9fdee6837425881328928ceff852. * fix: use .netlify for edge deployment test * refactor: add md file to edge function fixture * fix: add netlify edge tests to ci * chore: remove stray console log * wip: undo "dist" change on edge tests * chore: changeset * Revert "wip: undo "dist" change on edge tests" This reverts commit 70e565ef06b228150547bca92bc12d1c236c0ed9. * temp: add ignore to breaking edge tests
Diffstat (limited to 'packages/markdown/remark/src')
-rw-r--r--packages/markdown/remark/src/index.ts6
-rw-r--r--packages/markdown/remark/src/ssr-utils.ts8
2 files changed, 8 insertions, 6 deletions
diff --git a/packages/markdown/remark/src/index.ts b/packages/markdown/remark/src/index.ts
index 817174e4c..9dfc0e38c 100644
--- a/packages/markdown/remark/src/index.ts
+++ b/packages/markdown/remark/src/index.ts
@@ -13,7 +13,6 @@ import scopedStyles from './remark-scoped-styles.js';
import remarkShiki from './remark-shiki.js';
import remarkUnwrap from './remark-unwrap.js';
-import Slugger from 'github-slugger';
import rehypeRaw from 'rehype-raw';
import rehypeStringify from 'rehype-stringify';
import markdown from 'remark-parse';
@@ -26,11 +25,6 @@ export * from './types.js';
export const DEFAULT_REMARK_PLUGINS = ['remark-gfm', 'remark-smartypants'];
export const DEFAULT_REHYPE_PLUGINS = [];
-const slugger = new Slugger();
-export function slug(value: string): string {
- return slugger.slug(value);
-}
-
/** Shared utility for rendering markdown */
export async function renderMarkdown(
content: string,
diff --git a/packages/markdown/remark/src/ssr-utils.ts b/packages/markdown/remark/src/ssr-utils.ts
new file mode 100644
index 000000000..1491e24a5
--- /dev/null
+++ b/packages/markdown/remark/src/ssr-utils.ts
@@ -0,0 +1,8 @@
+/** Utilities used in deployment-ready SSR bundles */
+import Slugger from 'github-slugger';
+
+const slugger = new Slugger();
+/** @see {@link "/packages/astro/vite-plugin-markdown"} */
+export function slug(value: string): string {
+ return slugger.slug(value);
+}