diff --git a/astro.config.mjs b/astro.config.mjs index 2f700c0aa..be2978b12 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -2,9 +2,15 @@ import { defineConfig } from 'astro/config'; // https://astro.build/config import tailwind from "@astrojs/tailwind"; +import rehypeExternalLinks from 'rehype-external-links'; // https://astro.build/config export default defineConfig({ + markdown: { + rehypePlugins: [ + [rehypeExternalLinks, { target: '_blank'}] + ] + }, integrations: [tailwind({ config: { applyBaseStyles: false diff --git a/package.json b/package.json index e2fd2017c..4779bd72e 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "@astrojs/tailwind": "^2.1.3", "astro": "^1.8.0", "node-html-parser": "^6.1.4", + "rehype-external-links": "^2.0.1", "roadmap-renderer": "^1.0.1", "tailwindcss": "^3.2.4" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d8ea6c4ff..c81e3cf86 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,7 @@ specifiers: node-html-parser: ^6.1.4 prettier: ^2.8.1 prettier-plugin-astro: ^0.7.0 + rehype-external-links: ^2.0.1 roadmap-renderer: ^1.0.1 tailwindcss: ^3.2.4 @@ -15,6 +16,7 @@ dependencies: '@astrojs/tailwind': 2.1.3_tailwindcss@3.2.4 astro: 1.8.0 node-html-parser: 6.1.4 + rehype-external-links: 2.0.1 roadmap-renderer: 1.0.1 tailwindcss: 3.2.4 @@ -1796,6 +1798,11 @@ packages: resolution: {integrity: sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q==} dev: false + /is-absolute-url/4.0.1: + resolution: {integrity: sha512-/51/TKE88Lmm7Gc4/8btclNXWS+g50wXhYJq8HWIBAGUBnoAdRu1aXeh364t/O7wXDAcTJDP8PNuNKWUDWie+A==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: false + /is-alphabetical/2.0.1: resolution: {integrity: sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==} dev: false @@ -2882,6 +2889,17 @@ packages: tslib: 2.4.1 dev: false + /rehype-external-links/2.0.1: + resolution: {integrity: sha512-u2dNypma+ps12SJWlS23zvbqwNx0Hl24t0YHXSM/6FCZj/pqWETCO3WyyrvALv4JYvRtuPjhiv2Lpen15ESqbA==} + dependencies: + '@types/hast': 2.3.4 + extend: 3.0.2 + is-absolute-url: 4.0.1 + space-separated-tokens: 2.0.2 + unified: 10.1.2 + unist-util-visit: 4.1.1 + dev: false + /rehype-parse/8.0.4: resolution: {integrity: sha512-MJJKONunHjoTh4kc3dsM1v3C9kGrrxvA3U8PxZlP2SjH8RNUSrb+lF7Y0KVaUDnGH2QZ5vAn7ulkiajM9ifuqg==} dependencies: