From c5c43ae207bd9d446f33aad656733ee536d6ce34 Mon Sep 17 00:00:00 2001 From: Jeremy Stucki Date: Thu, 29 Feb 2024 15:24:10 +0100 Subject: [PATCH 01/11] feat: article RSC setup --- .../src/app/rsc-artikel/[...path]/page.tsx | 43 +++++++++++++++++++ .../republik-api/queries/ArticleQuery.gql | 18 ++++++++ 2 files changed, 61 insertions(+) create mode 100644 apps/www/src/app/rsc-artikel/[...path]/page.tsx create mode 100644 apps/www/src/graphql/republik-api/queries/ArticleQuery.gql diff --git a/apps/www/src/app/rsc-artikel/[...path]/page.tsx b/apps/www/src/app/rsc-artikel/[...path]/page.tsx new file mode 100644 index 0000000000..615179aca2 --- /dev/null +++ b/apps/www/src/app/rsc-artikel/[...path]/page.tsx @@ -0,0 +1,43 @@ +import { ArticleDocument } from '@app/graphql/republik-api/gql/graphql' +import { getClient } from '@app/lib/apollo/client' +import { renderMdast } from '@app/lib/mdast/render' +import { + matchType, + matchZone, + matchHeading, + matchParagraph, +} from '@republik/mdast-react-render' +import { notFound } from 'next/navigation' + +const schema = { rules: [] } +const renderSchema = (content) => renderMdast({ ...content }, schema) + +export default async function ArticlePage({ + params: { path }, +}: { + params: { path: string[] } +}) { + const client = await getClient() + const { data } = await client.query({ + query: ArticleDocument, + variables: { path: `/${path.join('/')}` }, + }) + + if (!data.article) { + return notFound() + } + + const { + article: { meta, content }, + } = data + + return ( +
+

{meta.title}

+ + {renderSchema(content)} + +
{JSON.stringify(content, null, 2)}
+
+ ) +} diff --git a/apps/www/src/graphql/republik-api/queries/ArticleQuery.gql b/apps/www/src/graphql/republik-api/queries/ArticleQuery.gql new file mode 100644 index 0000000000..21fe7c572f --- /dev/null +++ b/apps/www/src/graphql/republik-api/queries/ArticleQuery.gql @@ -0,0 +1,18 @@ +query Article($path: String!) { + article: document(path: $path) { + id + type + repoId + content + + meta { + publishDate + lastPublishedAt + template + path + title + kind + description + } + } +} From d04c52de3204b830ac033b959aa21a9f1c337b37 Mon Sep 17 00:00:00 2001 From: Jeremy Stucki Date: Thu, 29 Feb 2024 15:56:28 +0100 Subject: [PATCH 02/11] refactor(mdast-react-render): separate email rendering export, so other exports can be used in server components --- .../discussions/lib/Notifications.js | 2 +- packages/backend-modules/documents/lib/html.js | 2 +- packages/mdast/mdast-react-render/package.json | 18 +++++++++++++++--- packages/mdast/mdast-react-render/src/index.ts | 1 - .../styleguide/scripts/renderNewsletter.js | 2 +- .../src/templates/Article/test/render.test.js | 3 ++- 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/packages/backend-modules/discussions/lib/Notifications.js b/packages/backend-modules/discussions/lib/Notifications.js index 7ce96c0de3..79198721e3 100644 --- a/packages/backend-modules/discussions/lib/Notifications.js +++ b/packages/backend-modules/discussions/lib/Notifications.js @@ -1,5 +1,5 @@ const htmlToText = require('html-to-text') -const { renderEmail } = require('@republik/mdast-react-render') +const { renderEmail } = require('@republik/mdast-react-render/email') const { transformUser } = require('@orbiting/backend-modules-auth') const { diff --git a/packages/backend-modules/documents/lib/html.js b/packages/backend-modules/documents/lib/html.js index 60853eeac8..d36373874c 100644 --- a/packages/backend-modules/documents/lib/html.js +++ b/packages/backend-modules/documents/lib/html.js @@ -2,7 +2,7 @@ const { createNewsletterEmailSchema, articleEmailSchema, } = require('@orbiting/backend-modules-styleguide') -const { renderEmail } = require('@republik/mdast-react-render') +const { renderEmail } = require('@republik/mdast-react-render/email') const MissingNode = () => null diff --git a/packages/mdast/mdast-react-render/package.json b/packages/mdast/mdast-react-render/package.json index 0dc466f675..6bc4cd2fec 100644 --- a/packages/mdast/mdast-react-render/package.json +++ b/packages/mdast/mdast-react-render/package.json @@ -6,9 +6,21 @@ "main": "dist/index.js", "module": "dist/index.mjs", "types": "dist/index.d.ts", + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs", + "types": "./dist/index.d.ts" + }, + "./email": { + "require": "./dist/email.js", + "import": "./dist/email.mjs", + "types": "./dist/email.d.ts" + } + }, "scripts": { - "build": "tsup src/index.ts --format cjs,esm --dts --minify --clean --out-dir dist", - "dev": "tsup src/index.ts --format cjs,esm --dts --minify --clean --out-dir dist --sourcemap --watch", + "build": "tsup src/index.ts src/email.jsx --format cjs,esm --dts --minify --clean --out-dir dist", + "dev": "tsup src/index.ts src/email.jsx --format cjs,esm --dts --minify --clean --out-dir dist --sourcemap --watch", "test": "jest", "test:dev": "jest --watch" }, @@ -31,4 +43,4 @@ "react": "^18.2.0", "react-dom": "^18.2.0" } -} \ No newline at end of file +} diff --git a/packages/mdast/mdast-react-render/src/index.ts b/packages/mdast/mdast-react-render/src/index.ts index 157f9ccc52..5994c6b0ad 100644 --- a/packages/mdast/mdast-react-render/src/index.ts +++ b/packages/mdast/mdast-react-render/src/index.ts @@ -1,5 +1,4 @@ export { renderMdast } from './render' -export { renderEmail, Mso } from './email' export { matchHeading, matchImage, diff --git a/packages/styleguide/scripts/renderNewsletter.js b/packages/styleguide/scripts/renderNewsletter.js index 388ea1ef5f..0491e48bd7 100755 --- a/packages/styleguide/scripts/renderNewsletter.js +++ b/packages/styleguide/scripts/renderNewsletter.js @@ -6,7 +6,7 @@ require('dotenv').config() -const { renderEmail } = require('@republik/mdast-react-render') +const { renderEmail } = require('@republik/mdast-react-render/email') const { parse } = require('@republik/remark-preset') const rw = require('rw') const editorialNewsletterSchema = diff --git a/packages/styleguide/src/templates/Article/test/render.test.js b/packages/styleguide/src/templates/Article/test/render.test.js index 850fff539a..2f1f3c583d 100644 --- a/packages/styleguide/src/templates/Article/test/render.test.js +++ b/packages/styleguide/src/templates/Article/test/render.test.js @@ -1,5 +1,6 @@ import { BaB153Stub, ArticleStub } from './article.stub' -import { renderMdast, renderEmail } from '@republik/mdast-react-render' +import { renderMdast } from '@republik/mdast-react-render' +import { renderEmail } from '@republik/mdast-react-render/email' import { parse } from '@republik/remark-preset' import articleEmailSchema from '../email' import createSchema from '../index' From 356a9c235319a7f588157f0937395980bfed1ec1 Mon Sep 17 00:00:00 2001 From: Jeremy Stucki Date: Thu, 29 Feb 2024 15:57:04 +0100 Subject: [PATCH 03/11] feat: rendermdast --- apps/www/src/app/rsc-artikel/[...path]/page.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/www/src/app/rsc-artikel/[...path]/page.tsx b/apps/www/src/app/rsc-artikel/[...path]/page.tsx index 615179aca2..e8999d34a9 100644 --- a/apps/www/src/app/rsc-artikel/[...path]/page.tsx +++ b/apps/www/src/app/rsc-artikel/[...path]/page.tsx @@ -1,7 +1,8 @@ import { ArticleDocument } from '@app/graphql/republik-api/gql/graphql' import { getClient } from '@app/lib/apollo/client' -import { renderMdast } from '@app/lib/mdast/render' +// import { renderMdast } from '@app/lib/mdast/render' import { + renderMdast, matchType, matchZone, matchHeading, @@ -9,7 +10,14 @@ import { } from '@republik/mdast-react-render' import { notFound } from 'next/navigation' -const schema = { rules: [] } +const schema = { + rules: [ + { + matchMdast: matchType('root'), + component: ({ children }) => children, + }, + ], +} const renderSchema = (content) => renderMdast({ ...content }, schema) export default async function ArticlePage({ From 3e17e90b7eb282d6ea8473e0cb6bb7e4af59e614 Mon Sep 17 00:00:00 2001 From: Jeremy Stucki Date: Wed, 13 Mar 2024 14:25:15 +0100 Subject: [PATCH 04/11] fix: gql import --- apps/www/src/app/rsc-artikel/[...path]/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/www/src/app/rsc-artikel/[...path]/page.tsx b/apps/www/src/app/rsc-artikel/[...path]/page.tsx index e8999d34a9..dd3de2c5f8 100644 --- a/apps/www/src/app/rsc-artikel/[...path]/page.tsx +++ b/apps/www/src/app/rsc-artikel/[...path]/page.tsx @@ -1,4 +1,4 @@ -import { ArticleDocument } from '@app/graphql/republik-api/gql/graphql' +import { ArticleDocument } from '#graphql/republik-api/__generated__/gql/graphql' import { getClient } from '@app/lib/apollo/client' // import { renderMdast } from '@app/lib/mdast/render' import { From a66801fd70bc10df34882f6838e67e45124e1e9e Mon Sep 17 00:00:00 2001 From: Jeremy Stucki Date: Thu, 14 Mar 2024 10:52:47 +0100 Subject: [PATCH 05/11] feat: wip --- apps/www/package.json | 8 + .../rsc-artikel/[...path]/mdast-render.tsx | 56 +++ .../src/app/rsc-artikel/[...path]/page.tsx | 13 +- yarn.lock | 368 ++++++++++++++++++ 4 files changed, 436 insertions(+), 9 deletions(-) create mode 100644 apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx diff --git a/apps/www/package.json b/apps/www/package.json index e9db48f590..3e2a2d085a 100644 --- a/apps/www/package.json +++ b/apps/www/package.json @@ -125,6 +125,7 @@ "framer-motion": "^11.0.3", "glamor": "^2.20.40", "graphql": "^15.3.0", + "hast-util-to-jsx-runtime": "^2.3.0", "helmet": "^3.23.3", "ical-generator": "^6.0.0", "immer": "^9.0.12", @@ -135,6 +136,7 @@ "load-script": "^1.0.0", "lodash": "^4.17.21", "lru-cache": "^4.1.3", + "mdast-zone": "^6.1.0", "next": "^14.1.0", "next-themes": "^0.2.1", "photoswipe": "^4.1.3", @@ -149,10 +151,16 @@ "react-maskedinput": "^4.0.1", "react-simple-typewriter": "^5.0.1", "react-textarea-autosize": "^7.1.2", + "rehype-raw": "^7.0.0", + "remark": "^15.0.1", + "remark-rehype": "^11.1.0", "scroll-into-view": "1.16.2", "sharp": "^0.31.3", "subscriptions-transport-ws": "^0.9.19", "topojson": "^3.0.2", + "unified": "^11.0.4", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", "use-resize-observer": "^9.1.0", "useragent": "^2.3.0", "uuid": "^9.0.1", diff --git a/apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx b/apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx new file mode 100644 index 0000000000..f859099636 --- /dev/null +++ b/apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx @@ -0,0 +1,56 @@ +import { unified } from 'unified' +import remarkRehype from 'remark-rehype' +import { toJsxRuntime } from 'hast-util-to-jsx-runtime' +import { Fragment, jsx, jsxs } from 'react/jsx-runtime' +import { visit } from 'unist-util-visit' + +const r = unified() + // .use(() => (tree) => { + // visit(tree, 'zone', (node) => { + // console.log(node.type) + // }) + // }) + .use(remarkRehype, { + // unknownHandler: (state, node, parent) => { + // console.log(node.type) + // if (node.type === 'zone') { + // return { ...node, type: 'div' } + // } + // }, + // passThrough: ['zone'], + handlers: { + zone(state, node, parent) { + console.log(node.type) + return { + type: 'element', + tagName: 'section', + properties: {}, + children: state.all(node), + } + }, + }, + }) + .use( + () => (tree) => + toJsxRuntime(tree, { + Fragment, + jsx, + jsxs, + // components: { + // div: (props) => { + // console.log(props) + // return
+ // }, + // }, + }), + ) + +export const MdastRender = async ({ mdast }: { mdast: any }) => { + const nodes = await r.run(mdast) + return ( + <> + {nodes} +
{JSON.stringify(mdast, null, 2)}
+ + ) +} diff --git a/apps/www/src/app/rsc-artikel/[...path]/page.tsx b/apps/www/src/app/rsc-artikel/[...path]/page.tsx index dd3de2c5f8..409b929563 100644 --- a/apps/www/src/app/rsc-artikel/[...path]/page.tsx +++ b/apps/www/src/app/rsc-artikel/[...path]/page.tsx @@ -1,13 +1,8 @@ import { ArticleDocument } from '#graphql/republik-api/__generated__/gql/graphql' +import { MdastRender } from './mdast-render' import { getClient } from '@app/lib/apollo/client' // import { renderMdast } from '@app/lib/mdast/render' -import { - renderMdast, - matchType, - matchZone, - matchHeading, - matchParagraph, -} from '@republik/mdast-react-render' +import { matchType, renderMdast } from '@republik/mdast-react-render' import { notFound } from 'next/navigation' const schema = { @@ -43,9 +38,9 @@ export default async function ArticlePage({

{meta.title}

- {renderSchema(content)} + -
{JSON.stringify(content, null, 2)}
+ {/*
{JSON.stringify(content, null, 2)}
*/}
) } diff --git a/yarn.lock b/yarn.lock index 6b9d9ebcf9..aeec3dc23c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10882,6 +10882,11 @@ estree-util-is-identifier-name@^2.0.0: resolved "https://registry.yarnpkg.com/estree-util-is-identifier-name/-/estree-util-is-identifier-name-2.1.0.tgz#fb70a432dcb19045e77b05c8e732f1364b4b49b2" integrity sha512-bEN9VHRyXAUOjkKVQVvArFym08BTWB0aJPppZZr0UNyAqWsLaVfAqP7hbaTJjzHifmB5ebnR8Wm7r7yGN/HonQ== +estree-util-is-identifier-name@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/estree-util-is-identifier-name/-/estree-util-is-identifier-name-3.0.0.tgz#0b5ef4c4ff13508b34dcd01ecfa945f61fce5dbd" + integrity sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg== + estree-util-to-js@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/estree-util-to-js/-/estree-util-to-js-1.2.0.tgz#0f80d42443e3b13bd32f7012fffa6f93603f4a36" @@ -12588,6 +12593,27 @@ hast-util-to-estree@^2.0.0: unist-util-position "^4.0.0" zwitch "^2.0.0" +hast-util-to-jsx-runtime@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.0.tgz#3ed27caf8dc175080117706bf7269404a0aa4f7c" + integrity sha512-H/y0+IWPdsLLS738P8tDnrQ8Z+dj12zQQ6WC11TIM21C8WFVoIxcqWXf2H3hiTVZjF1AWqoimGwrTWecWrnmRQ== + dependencies: + "@types/estree" "^1.0.0" + "@types/hast" "^3.0.0" + "@types/unist" "^3.0.0" + comma-separated-tokens "^2.0.0" + devlop "^1.0.0" + estree-util-is-identifier-name "^3.0.0" + hast-util-whitespace "^3.0.0" + mdast-util-mdx-expression "^2.0.0" + mdast-util-mdx-jsx "^3.0.0" + mdast-util-mdxjs-esm "^2.0.0" + property-information "^6.0.0" + space-separated-tokens "^2.0.0" + style-to-object "^1.0.0" + unist-util-position "^5.0.0" + vfile-message "^4.0.0" + hast-util-to-mdast@^7.0.0: version "7.1.3" resolved "https://registry.yarnpkg.com/hast-util-to-mdast/-/hast-util-to-mdast-7.1.3.tgz#e4ad9098929355501773aed5e66c8181559eee04" @@ -12648,6 +12674,13 @@ hast-util-whitespace@^2.0.0: resolved "https://registry.yarnpkg.com/hast-util-whitespace/-/hast-util-whitespace-2.0.1.tgz#0ec64e257e6fc216c7d14c8a1b74d27d650b4557" integrity sha512-nAxA0v8+vXSBDt3AnRUNjyRIQ0rD+ntpbAp4LnPkumc5M9yUbSMa4XDU9Q6etY4f1Wp4bNgvc1yjiZtsTTrSng== +hast-util-whitespace@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz#7778ed9d3c92dd9e8c5c8f648a49c21fc51cb621" + integrity sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw== + dependencies: + "@types/hast" "^3.0.0" + hastscript@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/hastscript/-/hastscript-6.0.0.tgz#e8768d7eac56c3fdeac8a92830d58e811e5bf640" @@ -13198,6 +13231,11 @@ inline-style-parser@0.1.1: resolved "https://registry.yarnpkg.com/inline-style-parser/-/inline-style-parser-0.1.1.tgz#ec8a3b429274e9c0a1f1c4ffa9453a7fef72cea1" integrity sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q== +inline-style-parser@0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/inline-style-parser/-/inline-style-parser-0.2.2.tgz#d498b4e6de0373458fc610ff793f6b14ebf45633" + integrity sha512-EcKzdTHVe8wFVOGEYXiW9WmJXPjqi1T+234YpJr98RiFYKHV3cdy1+3mkTE+KHTHxFFLH51SfaGOoUdW+v7ViQ== + inline-style-prefixer@^3.0.6: version "3.0.8" resolved "https://registry.yarnpkg.com/inline-style-prefixer/-/inline-style-prefixer-3.0.8.tgz#8551b8e5b4d573244e66a34b04f7d32076a2b534" @@ -15778,6 +15816,14 @@ maxmind@^4.3.11: mmdb-lib "2.1.0" tiny-lru "11.2.5" +mdast-comment-marker@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/mdast-comment-marker/-/mdast-comment-marker-3.0.0.tgz#8233f27c985ac7be53678ecb453dd9648fa1b5c5" + integrity sha512-bt08sLmTNg00/UtVDiqZKocxqvQqqyQZAg1uaRuO/4ysXV5motg7RolF5o5yy/sY1rG0v2XgZEqFWho1+2UquA== + dependencies: + "@types/mdast" "^4.0.0" + mdast-util-mdx-expression "^2.0.0" + mdast-util-compact@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/mdast-util-compact/-/mdast-util-compact-1.0.4.tgz#d531bb7667b5123abf20859be086c4d06c894593" @@ -15829,6 +15875,24 @@ mdast-util-from-markdown@^1.0.0, mdast-util-from-markdown@^1.1.0, mdast-util-fro unist-util-stringify-position "^3.0.0" uvu "^0.5.0" +mdast-util-from-markdown@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.0.tgz#52f14815ec291ed061f2922fd14d6689c810cb88" + integrity sha512-n7MTOr/z+8NAX/wmhhDji8O3bRvPTV/U0oTCaZJkjhPSKTPhS3xufVhKGF8s1pJ7Ox4QgoIU7KHseh09S+9rTA== + dependencies: + "@types/mdast" "^4.0.0" + "@types/unist" "^3.0.0" + decode-named-character-reference "^1.0.0" + devlop "^1.0.0" + mdast-util-to-string "^4.0.0" + micromark "^4.0.0" + micromark-util-decode-numeric-character-reference "^2.0.0" + micromark-util-decode-string "^2.0.0" + micromark-util-normalize-identifier "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + unist-util-stringify-position "^4.0.0" + mdast-util-gfm-autolink-literal@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-1.0.3.tgz#67a13abe813d7eba350453a5333ae1bc0ec05c06" @@ -15907,6 +15971,18 @@ mdast-util-mdx-expression@^1.0.0: mdast-util-from-markdown "^1.0.0" mdast-util-to-markdown "^1.0.0" +mdast-util-mdx-expression@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.0.tgz#4968b73724d320a379110d853e943a501bfd9d87" + integrity sha512-fGCu8eWdKUKNu5mohVGkhBXCXGnOTLuFqOvGMvdikr+J1w7lDJgxThOKpwRWzzbyXAU2hhSwsmssOY4yTokluw== + dependencies: + "@types/estree-jsx" "^1.0.0" + "@types/hast" "^3.0.0" + "@types/mdast" "^4.0.0" + devlop "^1.0.0" + mdast-util-from-markdown "^2.0.0" + mdast-util-to-markdown "^2.0.0" + mdast-util-mdx-jsx@^2.0.0: version "2.1.4" resolved "https://registry.yarnpkg.com/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-2.1.4.tgz#7c1f07f10751a78963cfabee38017cbc8b7786d1" @@ -15925,6 +16001,25 @@ mdast-util-mdx-jsx@^2.0.0: unist-util-stringify-position "^3.0.0" vfile-message "^3.0.0" +mdast-util-mdx-jsx@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.1.1.tgz#f0375bda7a704448de9130356d0d7bf0d873b7b0" + integrity sha512-Di63TQEHbiApe6CFp/qQXCORHMHnmW2JFdr5PYH57LuEIPjijRHicAmL5wQu+B0/Q4p0qJaEOE1EkhiwxiNmAQ== + dependencies: + "@types/estree-jsx" "^1.0.0" + "@types/hast" "^3.0.0" + "@types/mdast" "^4.0.0" + "@types/unist" "^3.0.0" + ccount "^2.0.0" + devlop "^1.1.0" + mdast-util-from-markdown "^2.0.0" + mdast-util-to-markdown "^2.0.0" + parse-entities "^4.0.0" + stringify-entities "^4.0.0" + unist-util-remove-position "^5.0.0" + unist-util-stringify-position "^4.0.0" + vfile-message "^4.0.0" + mdast-util-mdx@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/mdast-util-mdx/-/mdast-util-mdx-2.0.1.tgz#49b6e70819b99bb615d7223c088d295e53bb810f" @@ -15947,6 +16042,18 @@ mdast-util-mdxjs-esm@^1.0.0: mdast-util-from-markdown "^1.0.0" mdast-util-to-markdown "^1.0.0" +mdast-util-mdxjs-esm@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-2.0.1.tgz#019cfbe757ad62dd557db35a695e7314bcc9fa97" + integrity sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg== + dependencies: + "@types/estree-jsx" "^1.0.0" + "@types/hast" "^3.0.0" + "@types/mdast" "^4.0.0" + devlop "^1.0.0" + mdast-util-from-markdown "^2.0.0" + mdast-util-to-markdown "^2.0.0" + mdast-util-phrasing@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/mdast-util-phrasing/-/mdast-util-phrasing-2.0.0.tgz#57e61f2be908be9f5fce54fcc2fa593687986267" @@ -15962,6 +16069,14 @@ mdast-util-phrasing@^3.0.0: "@types/mdast" "^3.0.0" unist-util-is "^5.0.0" +mdast-util-phrasing@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz#7cc0a8dec30eaf04b7b1a9661a92adb3382aa6e3" + integrity sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w== + dependencies: + "@types/mdast" "^4.0.0" + unist-util-is "^6.0.0" + mdast-util-to-hast@^12.1.0: version "12.3.0" resolved "https://registry.yarnpkg.com/mdast-util-to-hast/-/mdast-util-to-hast-12.3.0.tgz#045d2825fb04374e59970f5b3f279b5700f6fb49" @@ -16022,6 +16137,20 @@ mdast-util-to-markdown@^1.0.0, mdast-util-to-markdown@^1.3.0: unist-util-visit "^4.0.0" zwitch "^2.0.0" +mdast-util-to-markdown@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.0.tgz#9813f1d6e0cdaac7c244ec8c6dabfdb2102ea2b4" + integrity sha512-SR2VnIEdVNCJbP6y7kVTJgPLifdr8WEU440fQec7qHoHOUz/oJ2jmNRqdDQ3rbiStOXb2mCDGTuwsK5OPUgYlQ== + dependencies: + "@types/mdast" "^4.0.0" + "@types/unist" "^3.0.0" + longest-streak "^3.0.0" + mdast-util-phrasing "^4.0.0" + mdast-util-to-string "^4.0.0" + micromark-util-decode-string "^2.0.0" + unist-util-visit "^5.0.0" + zwitch "^2.0.0" + mdast-util-to-string@^1.0.0, mdast-util-to-string@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz#27055500103f51637bd07d01da01eb1967a43527" @@ -16034,6 +16163,23 @@ mdast-util-to-string@^3.0.0, mdast-util-to-string@^3.1.0: dependencies: "@types/mdast" "^3.0.0" +mdast-util-to-string@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz#7a5121475556a04e7eddeb67b264aae79d312814" + integrity sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg== + dependencies: + "@types/mdast" "^4.0.0" + +mdast-zone@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/mdast-zone/-/mdast-zone-6.1.0.tgz#7eb5e150e135f47c699fba62c0520f4b993391e2" + integrity sha512-5SlLJ6Z+MwF1jPlSDm0WFPssgbHeaV0rS/SuyAUJc4Nhozzb1ua5HQvNP5lu667VCESGe2q2o9o93nrTJhUhfA== + dependencies: + "@types/mdast" "^4.0.0" + "@types/unist" "^3.0.0" + mdast-comment-marker "^3.0.0" + unist-util-visit "^5.0.0" + mdn-data@2.0.14: version "2.0.14" resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.14.tgz#7113fc4281917d63ce29b43446f701e68c25ba50" @@ -16167,6 +16313,28 @@ micromark-core-commonmark@^1.0.0, micromark-core-commonmark@^1.0.1: micromark-util-types "^1.0.1" uvu "^0.5.0" +micromark-core-commonmark@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/micromark-core-commonmark/-/micromark-core-commonmark-2.0.0.tgz#50740201f0ee78c12a675bf3e68ffebc0bf931a3" + integrity sha512-jThOz/pVmAYUtkroV3D5c1osFXAMv9e0ypGDOIZuCeAe91/sD6BoE2Sjzt30yuXtwOYUmySOhMas/PVyh02itA== + dependencies: + decode-named-character-reference "^1.0.0" + devlop "^1.0.0" + micromark-factory-destination "^2.0.0" + micromark-factory-label "^2.0.0" + micromark-factory-space "^2.0.0" + micromark-factory-title "^2.0.0" + micromark-factory-whitespace "^2.0.0" + micromark-util-character "^2.0.0" + micromark-util-chunked "^2.0.0" + micromark-util-classify-character "^2.0.0" + micromark-util-html-tag-name "^2.0.0" + micromark-util-normalize-identifier "^2.0.0" + micromark-util-resolve-all "^2.0.0" + micromark-util-subtokenize "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + micromark-extension-gfm-autolink-literal@^1.0.0: version "1.0.5" resolved "https://registry.yarnpkg.com/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-1.0.5.tgz#5853f0e579bbd8ef9e39a7c0f0f27c5a063a66e7" @@ -16334,6 +16502,15 @@ micromark-factory-destination@^1.0.0: micromark-util-symbol "^1.0.0" micromark-util-types "^1.0.0" +micromark-factory-destination@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/micromark-factory-destination/-/micromark-factory-destination-2.0.0.tgz#857c94debd2c873cba34e0445ab26b74f6a6ec07" + integrity sha512-j9DGrQLm/Uhl2tCzcbLhy5kXsgkHUrjJHg4fFAeoMRwJmJerT9aw4FEhIbZStWN8A3qMwOp1uzHr4UL8AInxtA== + dependencies: + micromark-util-character "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + micromark-factory-label@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/micromark-factory-label/-/micromark-factory-label-1.1.0.tgz#cc95d5478269085cfa2a7282b3de26eb2e2dec68" @@ -16344,6 +16521,16 @@ micromark-factory-label@^1.0.0: micromark-util-types "^1.0.0" uvu "^0.5.0" +micromark-factory-label@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/micromark-factory-label/-/micromark-factory-label-2.0.0.tgz#17c5c2e66ce39ad6f4fc4cbf40d972f9096f726a" + integrity sha512-RR3i96ohZGde//4WSe/dJsxOX6vxIg9TimLAS3i4EhBAFx8Sm5SmqVfR8E87DPSR31nEAjZfbt91OMZWcNgdZw== + dependencies: + devlop "^1.0.0" + micromark-util-character "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + micromark-factory-mdx-expression@^1.0.0: version "1.0.9" resolved "https://registry.yarnpkg.com/micromark-factory-mdx-expression/-/micromark-factory-mdx-expression-1.0.9.tgz#57ba4571b69a867a1530f34741011c71c73a4976" @@ -16366,6 +16553,14 @@ micromark-factory-space@^1.0.0: micromark-util-character "^1.0.0" micromark-util-types "^1.0.0" +micromark-factory-space@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/micromark-factory-space/-/micromark-factory-space-2.0.0.tgz#5e7afd5929c23b96566d0e1ae018ae4fcf81d030" + integrity sha512-TKr+LIDX2pkBJXFLzpyPyljzYK3MtmllMUMODTQJIUfDGncESaqB90db9IAUcz4AZAJFdd8U9zOp9ty1458rxg== + dependencies: + micromark-util-character "^2.0.0" + micromark-util-types "^2.0.0" + micromark-factory-title@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/micromark-factory-title/-/micromark-factory-title-1.1.0.tgz#dd0fe951d7a0ac71bdc5ee13e5d1465ad7f50ea1" @@ -16376,6 +16571,16 @@ micromark-factory-title@^1.0.0: micromark-util-symbol "^1.0.0" micromark-util-types "^1.0.0" +micromark-factory-title@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/micromark-factory-title/-/micromark-factory-title-2.0.0.tgz#726140fc77892af524705d689e1cf06c8a83ea95" + integrity sha512-jY8CSxmpWLOxS+t8W+FG3Xigc0RDQA9bKMY/EwILvsesiRniiVMejYTE4wumNc2f4UbAa4WsHqe3J1QS1sli+A== + dependencies: + micromark-factory-space "^2.0.0" + micromark-util-character "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + micromark-factory-whitespace@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/micromark-factory-whitespace/-/micromark-factory-whitespace-1.1.0.tgz#798fb7489f4c8abafa7ca77eed6b5745853c9705" @@ -16386,6 +16591,16 @@ micromark-factory-whitespace@^1.0.0: micromark-util-symbol "^1.0.0" micromark-util-types "^1.0.0" +micromark-factory-whitespace@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.0.tgz#9e92eb0f5468083381f923d9653632b3cfb5f763" + integrity sha512-28kbwaBjc5yAI1XadbdPYHX/eDnqaUFVikLwrO7FDnKG7lpgxnvk/XGRhX/PN0mOZ+dBSZ+LgunHS+6tYQAzhA== + dependencies: + micromark-factory-space "^2.0.0" + micromark-util-character "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + micromark-util-character@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/micromark-util-character/-/micromark-util-character-1.2.0.tgz#4fedaa3646db249bc58caeb000eb3549a8ca5dcc" @@ -16409,6 +16624,13 @@ micromark-util-chunked@^1.0.0: dependencies: micromark-util-symbol "^1.0.0" +micromark-util-chunked@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/micromark-util-chunked/-/micromark-util-chunked-2.0.0.tgz#e51f4db85fb203a79dbfef23fd41b2f03dc2ef89" + integrity sha512-anK8SWmNphkXdaKgz5hJvGa7l00qmcaUQoMYsBwDlSKFKjc6gjGXPDw3FNL3Nbwq5L8gE+RCbGqTw49FK5Qyvg== + dependencies: + micromark-util-symbol "^2.0.0" + micromark-util-classify-character@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/micromark-util-classify-character/-/micromark-util-classify-character-1.1.0.tgz#6a7f8c8838e8a120c8e3c4f2ae97a2bff9190e9d" @@ -16418,6 +16640,15 @@ micromark-util-classify-character@^1.0.0: micromark-util-symbol "^1.0.0" micromark-util-types "^1.0.0" +micromark-util-classify-character@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/micromark-util-classify-character/-/micromark-util-classify-character-2.0.0.tgz#8c7537c20d0750b12df31f86e976d1d951165f34" + integrity sha512-S0ze2R9GH+fu41FA7pbSqNWObo/kzwf8rN/+IGlW/4tC6oACOs8B++bh+i9bVyNnwCcuksbFwsBme5OCKXCwIw== + dependencies: + micromark-util-character "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + micromark-util-combine-extensions@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/micromark-util-combine-extensions/-/micromark-util-combine-extensions-1.1.0.tgz#192e2b3d6567660a85f735e54d8ea6e3952dbe84" @@ -16426,6 +16657,14 @@ micromark-util-combine-extensions@^1.0.0: micromark-util-chunked "^1.0.0" micromark-util-types "^1.0.0" +micromark-util-combine-extensions@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.0.tgz#75d6ab65c58b7403616db8d6b31315013bfb7ee5" + integrity sha512-vZZio48k7ON0fVS3CUgFatWHoKbbLTK/rT7pzpJ4Bjp5JjkZeasRfrS9wsBdDJK2cJLHMckXZdzPSSr1B8a4oQ== + dependencies: + micromark-util-chunked "^2.0.0" + micromark-util-types "^2.0.0" + micromark-util-decode-numeric-character-reference@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-1.1.0.tgz#b1e6e17009b1f20bc652a521309c5f22c85eb1c6" @@ -16433,6 +16672,13 @@ micromark-util-decode-numeric-character-reference@^1.0.0: dependencies: micromark-util-symbol "^1.0.0" +micromark-util-decode-numeric-character-reference@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.1.tgz#2698bbb38f2a9ba6310e359f99fcb2b35a0d2bd5" + integrity sha512-bmkNc7z8Wn6kgjZmVHOX3SowGmVdhYS7yBpMnuMnPzDq/6xwVA604DuOXMZTO1lvq01g+Adfa0pE2UKGlxL1XQ== + dependencies: + micromark-util-symbol "^2.0.0" + micromark-util-decode-string@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/micromark-util-decode-string/-/micromark-util-decode-string-1.1.0.tgz#dc12b078cba7a3ff690d0203f95b5d5537f2809c" @@ -16443,6 +16689,16 @@ micromark-util-decode-string@^1.0.0: micromark-util-decode-numeric-character-reference "^1.0.0" micromark-util-symbol "^1.0.0" +micromark-util-decode-string@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/micromark-util-decode-string/-/micromark-util-decode-string-2.0.0.tgz#7dfa3a63c45aecaa17824e656bcdb01f9737154a" + integrity sha512-r4Sc6leeUTn3P6gk20aFMj2ntPwn6qpDZqWvYmAG6NgvFTIlj4WtrAudLi65qYoaGdXYViXYw2pkmn7QnIFasA== + dependencies: + decode-named-character-reference "^1.0.0" + micromark-util-character "^2.0.0" + micromark-util-decode-numeric-character-reference "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-encode@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/micromark-util-encode/-/micromark-util-encode-1.1.0.tgz#92e4f565fd4ccb19e0dcae1afab9a173bbeb19a5" @@ -16472,6 +16728,11 @@ micromark-util-html-tag-name@^1.0.0: resolved "https://registry.yarnpkg.com/micromark-util-html-tag-name/-/micromark-util-html-tag-name-1.2.0.tgz#48fd7a25826f29d2f71479d3b4e83e94829b3588" integrity sha512-VTQzcuQgFUD7yYztuQFKXT49KghjtETQ+Wv/zUjGSGBioZnkA4P1XXZPT1FHeJA6RwRXSF47yvJ1tsJdoxwO+Q== +micromark-util-html-tag-name@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.0.tgz#ae34b01cbe063363847670284c6255bb12138ec4" + integrity sha512-xNn4Pqkj2puRhKdKTm8t1YHC/BAjx6CEwRFXntTaRf/x16aqka6ouVoutm+QdkISTlT7e2zU7U4ZdlDLJd2Mcw== + micromark-util-normalize-identifier@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-1.1.0.tgz#7a73f824eb9f10d442b4d7f120fecb9b38ebf8b7" @@ -16479,6 +16740,13 @@ micromark-util-normalize-identifier@^1.0.0: dependencies: micromark-util-symbol "^1.0.0" +micromark-util-normalize-identifier@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.0.tgz#91f9a4e65fe66cc80c53b35b0254ad67aa431d8b" + integrity sha512-2xhYT0sfo85FMrUPtHcPo2rrp1lwbDEEzpx7jiH2xXJLqBuy4H0GgXk5ToU8IEwoROtXuL8ND0ttVa4rNqYK3w== + dependencies: + micromark-util-symbol "^2.0.0" + micromark-util-resolve-all@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/micromark-util-resolve-all/-/micromark-util-resolve-all-1.1.0.tgz#4652a591ee8c8fa06714c9b54cd6c8e693671188" @@ -16486,6 +16754,13 @@ micromark-util-resolve-all@^1.0.0: dependencies: micromark-util-types "^1.0.0" +micromark-util-resolve-all@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.0.tgz#189656e7e1a53d0c86a38a652b284a252389f364" + integrity sha512-6KU6qO7DZ7GJkaCgwBNtplXCvGkJToU86ybBAUdavvgsCiG8lSSvYxr9MhwmQ+udpzywHsl4RpGJsYWG1pDOcA== + dependencies: + micromark-util-types "^2.0.0" + micromark-util-sanitize-uri@^1.0.0, micromark-util-sanitize-uri@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-1.2.0.tgz#613f738e4400c6eedbc53590c67b197e30d7f90d" @@ -16514,6 +16789,16 @@ micromark-util-subtokenize@^1.0.0: micromark-util-types "^1.0.0" uvu "^0.5.0" +micromark-util-subtokenize@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/micromark-util-subtokenize/-/micromark-util-subtokenize-2.0.0.tgz#9f412442d77e0c5789ffdf42377fa8a2bcbdf581" + integrity sha512-vc93L1t+gpR3p8jxeVdaYlbV2jTYteDje19rNSS/H5dlhxUYll5Fy6vJ2cDwP8RnsXi818yGty1ayP55y3W6fg== + dependencies: + devlop "^1.0.0" + micromark-util-chunked "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + micromark-util-symbol@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/micromark-util-symbol/-/micromark-util-symbol-1.1.0.tgz#813cd17837bdb912d069a12ebe3a44b6f7063142" @@ -16557,6 +16842,29 @@ micromark@^3.0.0: micromark-util-types "^1.0.1" uvu "^0.5.0" +micromark@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/micromark/-/micromark-4.0.0.tgz#84746a249ebd904d9658cfabc1e8e5f32cbc6249" + integrity sha512-o/sd0nMof8kYff+TqcDx3VSrgBTcZpSvYcAHIfHhv5VAuNmisCxjhx6YmxS8PFEpb9z5WKWKPdzf0jM23ro3RQ== + dependencies: + "@types/debug" "^4.0.0" + debug "^4.0.0" + decode-named-character-reference "^1.0.0" + devlop "^1.0.0" + micromark-core-commonmark "^2.0.0" + micromark-factory-space "^2.0.0" + micromark-util-character "^2.0.0" + micromark-util-chunked "^2.0.0" + micromark-util-combine-extensions "^2.0.0" + micromark-util-decode-numeric-character-reference "^2.0.0" + micromark-util-encode "^2.0.0" + micromark-util-normalize-identifier "^2.0.0" + micromark-util-resolve-all "^2.0.0" + micromark-util-sanitize-uri "^2.0.0" + micromark-util-subtokenize "^2.0.0" + micromark-util-symbol "^2.0.0" + micromark-util-types "^2.0.0" + micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.5: version "4.0.5" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" @@ -19590,6 +19898,16 @@ remark-parse@^10.0.0: mdast-util-from-markdown "^1.0.0" unified "^10.0.0" +remark-parse@^11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-11.0.0.tgz#aa60743fcb37ebf6b069204eb4da304e40db45a1" + integrity sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA== + dependencies: + "@types/mdast" "^4.0.0" + mdast-util-from-markdown "^2.0.0" + micromark-util-types "^2.0.0" + unified "^11.0.0" + remark-parse@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-4.0.0.tgz#99f1f049afac80382366e2e0d0bd55429dd45d8b" @@ -19705,6 +20023,26 @@ remark-rehype@^10.0.0: mdast-util-to-hast "^12.1.0" unified "^10.0.0" +remark-rehype@^11.1.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/remark-rehype/-/remark-rehype-11.1.0.tgz#d5f264f42bcbd4d300f030975609d01a1697ccdc" + integrity sha512-z3tJrAs2kIs1AqIIy6pzHmAHlF1hWQ+OdY4/hv+Wxe35EhyLKcajL33iUEn3ScxtFox9nUvRufR/Zre8Q08H/g== + dependencies: + "@types/hast" "^3.0.0" + "@types/mdast" "^4.0.0" + mdast-util-to-hast "^13.0.0" + unified "^11.0.0" + vfile "^6.0.0" + +remark-stringify@^11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/remark-stringify/-/remark-stringify-11.0.0.tgz#4c5b01dd711c269df1aaae11743eb7e2e7636fd3" + integrity sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw== + dependencies: + "@types/mdast" "^4.0.0" + mdast-util-to-markdown "^2.0.0" + unified "^11.0.0" + remark-stringify@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/remark-stringify/-/remark-stringify-4.0.0.tgz#4431884c0418f112da44991b4e356cfe37facd87" @@ -19774,6 +20112,16 @@ remark@^10.0.1: remark-stringify "^6.0.0" unified "^7.0.0" +remark@^15.0.1: + version "15.0.1" + resolved "https://registry.yarnpkg.com/remark/-/remark-15.0.1.tgz#ac7e7563260513b66426bc47f850e7aa5862c37c" + integrity sha512-Eht5w30ruCXgFmxVUSlNWQ9iiimq07URKeFS3hNc8cUWy1llX4KDWfyEDZRycMc+znsN9Ux5/tJ/BFdgdOwA3A== + dependencies: + "@types/mdast" "^4.0.0" + remark-parse "^11.0.0" + remark-stringify "^11.0.0" + unified "^11.0.0" + remedial@^1.0.7: version "1.0.8" resolved "https://registry.yarnpkg.com/remedial/-/remedial-1.0.8.tgz#a5e4fd52a0e4956adbaf62da63a5a46a78c578a0" @@ -21373,6 +21721,13 @@ style-to-object@^0.4.1: dependencies: inline-style-parser "0.1.1" +style-to-object@^1.0.0: + version "1.0.5" + resolved "https://registry.yarnpkg.com/style-to-object/-/style-to-object-1.0.5.tgz#5e918349bc3a39eee3a804497d97fcbbf2f0d7c0" + integrity sha512-rDRwHtoDD3UMMrmZ6BzOW0naTjMsVZLIjsGleSKS/0Oz+cgCfAPRspaqJuE8rDzpKha/nEvnM0IF4seEAZUTKQ== + dependencies: + inline-style-parser "0.2.2" + styled-jsx@5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-5.1.1.tgz#839a1c3aaacc4e735fed0781b8619ea5d0009d1f" @@ -22446,6 +22801,19 @@ unified@^10.0.0: trough "^2.0.0" vfile "^5.0.0" +unified@^11.0.0, unified@^11.0.4: + version "11.0.4" + resolved "https://registry.yarnpkg.com/unified/-/unified-11.0.4.tgz#f4be0ac0fe4c88cb873687c07c64c49ed5969015" + integrity sha512-apMPnyLjAX+ty4OrNap7yumyVAMlKx5IWU2wlzzUdYJO9A8f1p9m/gywF/GM2ZDFcjQPrx59Mc90KwmxsoklxQ== + dependencies: + "@types/unist" "^3.0.0" + bail "^2.0.0" + devlop "^1.0.0" + extend "^3.0.0" + is-plain-obj "^4.0.0" + trough "^2.0.0" + vfile "^6.0.0" + unified@^6.1.5: version "6.2.0" resolved "https://registry.yarnpkg.com/unified/-/unified-6.2.0.tgz#7fbd630f719126d67d40c644b7e3f617035f6dba" From 1e992e96059129b838f4aa722f7cde4d22e98e03 Mon Sep 17 00:00:00 2001 From: Jeremy Stucki Date: Thu, 14 Mar 2024 18:03:04 +0100 Subject: [PATCH 06/11] feat: wipwip --- apps/www/package.json | 7 +- .../rsc-artikel/[...path]/mdast-render.tsx | 85 +++++++++---------- yarn.lock | 58 +++---------- 3 files changed, 52 insertions(+), 98 deletions(-) diff --git a/apps/www/package.json b/apps/www/package.json index 3e2a2d085a..206f1fe2e3 100644 --- a/apps/www/package.json +++ b/apps/www/package.json @@ -125,7 +125,6 @@ "framer-motion": "^11.0.3", "glamor": "^2.20.40", "graphql": "^15.3.0", - "hast-util-to-jsx-runtime": "^2.3.0", "helmet": "^3.23.3", "ical-generator": "^6.0.0", "immer": "^9.0.12", @@ -136,7 +135,6 @@ "load-script": "^1.0.0", "lodash": "^4.17.21", "lru-cache": "^4.1.3", - "mdast-zone": "^6.1.0", "next": "^14.1.0", "next-themes": "^0.2.1", "photoswipe": "^4.1.3", @@ -151,16 +149,13 @@ "react-maskedinput": "^4.0.1", "react-simple-typewriter": "^5.0.1", "react-textarea-autosize": "^7.1.2", - "rehype-raw": "^7.0.0", - "remark": "^15.0.1", + "rehype-react": "^8.0.0", "remark-rehype": "^11.1.0", "scroll-into-view": "1.16.2", "sharp": "^0.31.3", "subscriptions-transport-ws": "^0.9.19", "topojson": "^3.0.2", "unified": "^11.0.4", - "unist-util-position": "^5.0.0", - "unist-util-visit": "^5.0.0", "use-resize-observer": "^9.1.0", "useragent": "^2.3.0", "uuid": "^9.0.1", diff --git a/apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx b/apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx index f859099636..3aa636bdc6 100644 --- a/apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx +++ b/apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx @@ -1,52 +1,49 @@ -import { unified } from 'unified' -import remarkRehype from 'remark-rehype' -import { toJsxRuntime } from 'hast-util-to-jsx-runtime' +import { css } from '@app/styled-system/css' import { Fragment, jsx, jsxs } from 'react/jsx-runtime' -import { visit } from 'unist-util-visit' +import rehypeReact, { Options as RehypeReactOptions } from 'rehype-react' +import remarkRehype, { Options as RemarkRehypeOptions } from 'remark-rehype' +import { unified } from 'unified' -const r = unified() - // .use(() => (tree) => { - // visit(tree, 'zone', (node) => { - // console.log(node.type) - // }) - // }) - .use(remarkRehype, { - // unknownHandler: (state, node, parent) => { - // console.log(node.type) - // if (node.type === 'zone') { - // return { ...node, type: 'div' } - // } - // }, - // passThrough: ['zone'], - handlers: { - zone(state, node, parent) { - console.log(node.type) - return { - type: 'element', - tagName: 'section', - properties: {}, - children: state.all(node), - } - }, +const remarkRehypeOptions: RemarkRehypeOptions = { + handlers: { + // @ts-expect-error zone is not a default mdast node + zone(state, node) { + return { + type: 'element', + tagName: node.identifier, + properties: { ...node.data }, + children: state.all(node), + } }, - }) - .use( - () => (tree) => - toJsxRuntime(tree, { - Fragment, - jsx, - jsxs, - // components: { - // div: (props) => { - // console.log(props) - // return
- // }, - // }, - }), - ) + }, +} + +const rehypeReactOptions: RehypeReactOptions = { + Fragment, + jsx, + jsxs, + components: { + // @ts-expect-error zones are converted to custom components + FIGURE: (props) => { + return
+ }, + CENTER: (props) => { + return ( +
+ ) + }, + TITLE: (props) => { + return
+ }, + }, +} + +const processor = unified() + .use(remarkRehype, remarkRehypeOptions) + .use(rehypeReact, rehypeReactOptions) export const MdastRender = async ({ mdast }: { mdast: any }) => { - const nodes = await r.run(mdast) + const nodes = await processor.run(mdast) return ( <> {nodes} diff --git a/yarn.lock b/yarn.lock index aeec3dc23c..8f067cdadd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12593,7 +12593,7 @@ hast-util-to-estree@^2.0.0: unist-util-position "^4.0.0" zwitch "^2.0.0" -hast-util-to-jsx-runtime@^2.3.0: +hast-util-to-jsx-runtime@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.0.tgz#3ed27caf8dc175080117706bf7269404a0aa4f7c" integrity sha512-H/y0+IWPdsLLS738P8tDnrQ8Z+dj12zQQ6WC11TIM21C8WFVoIxcqWXf2H3hiTVZjF1AWqoimGwrTWecWrnmRQ== @@ -15816,14 +15816,6 @@ maxmind@^4.3.11: mmdb-lib "2.1.0" tiny-lru "11.2.5" -mdast-comment-marker@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/mdast-comment-marker/-/mdast-comment-marker-3.0.0.tgz#8233f27c985ac7be53678ecb453dd9648fa1b5c5" - integrity sha512-bt08sLmTNg00/UtVDiqZKocxqvQqqyQZAg1uaRuO/4ysXV5motg7RolF5o5yy/sY1rG0v2XgZEqFWho1+2UquA== - dependencies: - "@types/mdast" "^4.0.0" - mdast-util-mdx-expression "^2.0.0" - mdast-util-compact@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/mdast-util-compact/-/mdast-util-compact-1.0.4.tgz#d531bb7667b5123abf20859be086c4d06c894593" @@ -16170,16 +16162,6 @@ mdast-util-to-string@^4.0.0: dependencies: "@types/mdast" "^4.0.0" -mdast-zone@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/mdast-zone/-/mdast-zone-6.1.0.tgz#7eb5e150e135f47c699fba62c0520f4b993391e2" - integrity sha512-5SlLJ6Z+MwF1jPlSDm0WFPssgbHeaV0rS/SuyAUJc4Nhozzb1ua5HQvNP5lu667VCESGe2q2o9o93nrTJhUhfA== - dependencies: - "@types/mdast" "^4.0.0" - "@types/unist" "^3.0.0" - mdast-comment-marker "^3.0.0" - unist-util-visit "^5.0.0" - mdn-data@2.0.14: version "2.0.14" resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.14.tgz#7113fc4281917d63ce29b43446f701e68c25ba50" @@ -19829,6 +19811,15 @@ rehype-raw@^7.0.0: hast-util-raw "^9.0.0" vfile "^6.0.0" +rehype-react@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/rehype-react/-/rehype-react-8.0.0.tgz#a3e2fecb10579af7bb065c7b232410a500699ba7" + integrity sha512-vzo0YxYbB2HE+36+9HWXVdxNoNDubx63r5LBzpxBGVWM8s9mdnMdbmuJBAX6TTyuGdZjZix6qU3GcSuKCIWivw== + dependencies: + "@types/hast" "^3.0.0" + hast-util-to-jsx-runtime "^2.0.0" + unified "^11.0.0" + rehype-remark@^8.0.0: version "8.1.1" resolved "https://registry.yarnpkg.com/rehype-remark/-/rehype-remark-8.1.1.tgz#aa2e7a9b454aaf498788982e3095a0535241e7fa" @@ -19898,16 +19889,6 @@ remark-parse@^10.0.0: mdast-util-from-markdown "^1.0.0" unified "^10.0.0" -remark-parse@^11.0.0: - version "11.0.0" - resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-11.0.0.tgz#aa60743fcb37ebf6b069204eb4da304e40db45a1" - integrity sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA== - dependencies: - "@types/mdast" "^4.0.0" - mdast-util-from-markdown "^2.0.0" - micromark-util-types "^2.0.0" - unified "^11.0.0" - remark-parse@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-4.0.0.tgz#99f1f049afac80382366e2e0d0bd55429dd45d8b" @@ -20034,15 +20015,6 @@ remark-rehype@^11.1.0: unified "^11.0.0" vfile "^6.0.0" -remark-stringify@^11.0.0: - version "11.0.0" - resolved "https://registry.yarnpkg.com/remark-stringify/-/remark-stringify-11.0.0.tgz#4c5b01dd711c269df1aaae11743eb7e2e7636fd3" - integrity sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw== - dependencies: - "@types/mdast" "^4.0.0" - mdast-util-to-markdown "^2.0.0" - unified "^11.0.0" - remark-stringify@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/remark-stringify/-/remark-stringify-4.0.0.tgz#4431884c0418f112da44991b4e356cfe37facd87" @@ -20112,16 +20084,6 @@ remark@^10.0.1: remark-stringify "^6.0.0" unified "^7.0.0" -remark@^15.0.1: - version "15.0.1" - resolved "https://registry.yarnpkg.com/remark/-/remark-15.0.1.tgz#ac7e7563260513b66426bc47f850e7aa5862c37c" - integrity sha512-Eht5w30ruCXgFmxVUSlNWQ9iiimq07URKeFS3hNc8cUWy1llX4KDWfyEDZRycMc+znsN9Ux5/tJ/BFdgdOwA3A== - dependencies: - "@types/mdast" "^4.0.0" - remark-parse "^11.0.0" - remark-stringify "^11.0.0" - unified "^11.0.0" - remedial@^1.0.7: version "1.0.8" resolved "https://registry.yarnpkg.com/remedial/-/remedial-1.0.8.tgz#a5e4fd52a0e4956adbaf62da63a5a46a78c578a0" From 5f03ffd85c56a3d0e16711ebf62cf1ab36010bce Mon Sep 17 00:00:00 2001 From: Jeremy Stucki Date: Fri, 15 Mar 2024 06:49:25 +0100 Subject: [PATCH 07/11] feat: wip --- .../[...path]/components/center.tsx | 5 +++ .../[...path]/components/figure.tsx | 1 + .../rsc-artikel/[...path]/components/index.ts | 3 ++ .../[...path]/components/title.tsx | 5 +++ .../rsc-artikel/[...path]/mdast-render.tsx | 31 +++++++++---------- 5 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 apps/www/src/app/rsc-artikel/[...path]/components/center.tsx create mode 100644 apps/www/src/app/rsc-artikel/[...path]/components/figure.tsx create mode 100644 apps/www/src/app/rsc-artikel/[...path]/components/index.ts create mode 100644 apps/www/src/app/rsc-artikel/[...path]/components/title.tsx diff --git a/apps/www/src/app/rsc-artikel/[...path]/components/center.tsx b/apps/www/src/app/rsc-artikel/[...path]/components/center.tsx new file mode 100644 index 0000000000..f34fc7514e --- /dev/null +++ b/apps/www/src/app/rsc-artikel/[...path]/components/center.tsx @@ -0,0 +1,5 @@ +import { css } from '@app/styled-system/css' + +export const Center = (props) => { + return
+} diff --git a/apps/www/src/app/rsc-artikel/[...path]/components/figure.tsx b/apps/www/src/app/rsc-artikel/[...path]/components/figure.tsx new file mode 100644 index 0000000000..959a530f05 --- /dev/null +++ b/apps/www/src/app/rsc-artikel/[...path]/components/figure.tsx @@ -0,0 +1 @@ +export const Figure = (props) =>
diff --git a/apps/www/src/app/rsc-artikel/[...path]/components/index.ts b/apps/www/src/app/rsc-artikel/[...path]/components/index.ts new file mode 100644 index 0000000000..dd186b61be --- /dev/null +++ b/apps/www/src/app/rsc-artikel/[...path]/components/index.ts @@ -0,0 +1,3 @@ +export { Center } from './center' +export { Figure } from './figure' +export { Title } from './title' diff --git a/apps/www/src/app/rsc-artikel/[...path]/components/title.tsx b/apps/www/src/app/rsc-artikel/[...path]/components/title.tsx new file mode 100644 index 0000000000..841e000d99 --- /dev/null +++ b/apps/www/src/app/rsc-artikel/[...path]/components/title.tsx @@ -0,0 +1,5 @@ +import { css } from '@app/styled-system/css' + +export const Title = (props) => { + return
+} diff --git a/apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx b/apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx index 3aa636bdc6..4dbbeb025a 100644 --- a/apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx +++ b/apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx @@ -1,16 +1,22 @@ -import { css } from '@app/styled-system/css' +import * as components from '@app/app/rsc-artikel/[...path]/components' import { Fragment, jsx, jsxs } from 'react/jsx-runtime' import rehypeReact, { Options as RehypeReactOptions } from 'rehype-react' import remarkRehype, { Options as RemarkRehypeOptions } from 'remark-rehype' import { unified } from 'unified' +const identifierToComponentName = (id: string): string => { + return id.charAt(0).toUpperCase() + id.slice(1).toLowerCase() +} + const remarkRehypeOptions: RemarkRehypeOptions = { handlers: { // @ts-expect-error zone is not a default mdast node zone(state, node) { + const componentName = identifierToComponentName(node.identifier) + return { type: 'element', - tagName: node.identifier, + tagName: componentName in components ? componentName : 'section', properties: { ...node.data }, children: state.all(node), } @@ -22,20 +28,8 @@ const rehypeReactOptions: RehypeReactOptions = { Fragment, jsx, jsxs, - components: { - // @ts-expect-error zones are converted to custom components - FIGURE: (props) => { - return
- }, - CENTER: (props) => { - return ( -
- ) - }, - TITLE: (props) => { - return
- }, - }, + // @ts-expect-error zones are converted to custom components + components, } const processor = unified() @@ -43,7 +37,10 @@ const processor = unified() .use(rehypeReact, rehypeReactOptions) export const MdastRender = async ({ mdast }: { mdast: any }) => { - const nodes = await processor.run(mdast) + const nodes = await processor.process(mdast) + + console.log(nodes) + return ( <> {nodes} From a6d7da88a93fb10eba4ef97f1de27a2ba6e7bc6c Mon Sep 17 00:00:00 2001 From: Jeremy Stucki Date: Fri, 15 Mar 2024 10:44:23 +0100 Subject: [PATCH 08/11] fix: make it work --- .../app/rsc-artikel/[...path]/mdast-render.tsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx b/apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx index 4dbbeb025a..279756cf7c 100644 --- a/apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx +++ b/apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx @@ -32,14 +32,17 @@ const rehypeReactOptions: RehypeReactOptions = { components, } -const processor = unified() - .use(remarkRehype, remarkRehypeOptions) - .use(rehypeReact, rehypeReactOptions) - export const MdastRender = async ({ mdast }: { mdast: any }) => { - const nodes = await processor.process(mdast) - - console.log(nodes) + console.time('mdast->rehype') + const rehypeTree = await unified() + .use(remarkRehype, remarkRehypeOptions) + .run(mdast) + console.timeEnd('mdast->rehype') + console.time('rehype->jsx') + const nodes = unified() + .use(rehypeReact, rehypeReactOptions) + .stringify(rehypeTree) + console.timeEnd('rehype->jsx') return ( <> From d4b46080b04e93eeb7034a2e70d47faa75bd98d3 Mon Sep 17 00:00:00 2001 From: Jeremy Stucki Date: Fri, 15 Mar 2024 10:58:01 +0100 Subject: [PATCH 09/11] feat: cross-link legacy and rsc article pages --- apps/www/components/Article/Page.js | 16 ++++++++++++++++ apps/www/src/app/rsc-artikel/[...path]/page.tsx | 2 ++ 2 files changed, 18 insertions(+) diff --git a/apps/www/components/Article/Page.js b/apps/www/components/Article/Page.js index 93ef2ececb..f9b7449063 100644 --- a/apps/www/components/Article/Page.js +++ b/apps/www/components/Article/Page.js @@ -772,6 +772,7 @@ const ArticlePage = ({
)} + {isFlyer ? ( )} + {isEditor && ( +
+ + RSC (Beta) + +
+ )} + {(hasAudioSource || article?.meta?.willBeReadAloud) && (
diff --git a/apps/www/src/app/rsc-artikel/[...path]/page.tsx b/apps/www/src/app/rsc-artikel/[...path]/page.tsx index 409b929563..369d8c9682 100644 --- a/apps/www/src/app/rsc-artikel/[...path]/page.tsx +++ b/apps/www/src/app/rsc-artikel/[...path]/page.tsx @@ -3,6 +3,7 @@ import { MdastRender } from './mdast-render' import { getClient } from '@app/lib/apollo/client' // import { renderMdast } from '@app/lib/mdast/render' import { matchType, renderMdast } from '@republik/mdast-react-render' +import Link from 'next/link' import { notFound } from 'next/navigation' const schema = { @@ -36,6 +37,7 @@ export default async function ArticlePage({ return (
+ Back to legacy article view

{meta.title}

From 44645d4e35a3511babfeeec0e410a4ef79c369eb Mon Sep 17 00:00:00 2001 From: Jeremy Stucki Date: Fri, 15 Mar 2024 16:46:29 +0100 Subject: [PATCH 10/11] feat: implement some styles and components --- .../[...path]/components/center.tsx | 27 ++++++++++++++++++- .../rsc-artikel/[...path]/components/index.ts | 3 +++ .../[...path]/components/infobox.tsx | 18 +++++++++++++ .../rsc-artikel/[...path]/components/tags.tsx | 22 +++++++++++++++ .../rsc-artikel/[...path]/mdast-render.tsx | 1 - 5 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 apps/www/src/app/rsc-artikel/[...path]/components/infobox.tsx create mode 100644 apps/www/src/app/rsc-artikel/[...path]/components/tags.tsx diff --git a/apps/www/src/app/rsc-artikel/[...path]/components/center.tsx b/apps/www/src/app/rsc-artikel/[...path]/components/center.tsx index f34fc7514e..60096e87f9 100644 --- a/apps/www/src/app/rsc-artikel/[...path]/components/center.tsx +++ b/apps/www/src/app/rsc-artikel/[...path]/components/center.tsx @@ -1,5 +1,30 @@ import { css } from '@app/styled-system/css' export const Center = (props) => { - return
+ return ( +
+ ) } diff --git a/apps/www/src/app/rsc-artikel/[...path]/components/index.ts b/apps/www/src/app/rsc-artikel/[...path]/components/index.ts index dd186b61be..22f9bd356a 100644 --- a/apps/www/src/app/rsc-artikel/[...path]/components/index.ts +++ b/apps/www/src/app/rsc-artikel/[...path]/components/index.ts @@ -1,3 +1,6 @@ export { Center } from './center' export { Figure } from './figure' +export { Infobox } from './infobox' export { Title } from './title' + +export * from './tags' diff --git a/apps/www/src/app/rsc-artikel/[...path]/components/infobox.tsx b/apps/www/src/app/rsc-artikel/[...path]/components/infobox.tsx new file mode 100644 index 0000000000..161a9411b7 --- /dev/null +++ b/apps/www/src/app/rsc-artikel/[...path]/components/infobox.tsx @@ -0,0 +1,18 @@ +import { css } from '@app/styled-system/css' + +export const Infobox = (props) => { + return ( +
+ ) +} diff --git a/apps/www/src/app/rsc-artikel/[...path]/components/tags.tsx b/apps/www/src/app/rsc-artikel/[...path]/components/tags.tsx new file mode 100644 index 0000000000..a3ac5a5624 --- /dev/null +++ b/apps/www/src/app/rsc-artikel/[...path]/components/tags.tsx @@ -0,0 +1,22 @@ +import { css } from '@app/styled-system/css' +import Link from 'next/link' + +export const a = (props) => { + const [title, description] = (props.title || '').split('%%') + + return description ? ( + + ) : ( + + ) +} diff --git a/apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx b/apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx index 279756cf7c..4698e5604d 100644 --- a/apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx +++ b/apps/www/src/app/rsc-artikel/[...path]/mdast-render.tsx @@ -28,7 +28,6 @@ const rehypeReactOptions: RehypeReactOptions = { Fragment, jsx, jsxs, - // @ts-expect-error zones are converted to custom components components, } From 6e8789da637e71c9a7d80ed3696f8ef3ca74f284 Mon Sep 17 00:00:00 2001 From: Jeremy Stucki Date: Fri, 15 Mar 2024 16:52:56 +0100 Subject: [PATCH 11/11] feat: layout and page title --- .../src/app/rsc-artikel/[...path]/page.tsx | 24 +++++++++++-------- apps/www/src/app/rsc-artikel/layout.tsx | 20 ++++++++++++++++ 2 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 apps/www/src/app/rsc-artikel/layout.tsx diff --git a/apps/www/src/app/rsc-artikel/[...path]/page.tsx b/apps/www/src/app/rsc-artikel/[...path]/page.tsx index 369d8c9682..2023f1765b 100644 --- a/apps/www/src/app/rsc-artikel/[...path]/page.tsx +++ b/apps/www/src/app/rsc-artikel/[...path]/page.tsx @@ -1,20 +1,24 @@ import { ArticleDocument } from '#graphql/republik-api/__generated__/gql/graphql' -import { MdastRender } from './mdast-render' import { getClient } from '@app/lib/apollo/client' +import { MdastRender } from './mdast-render' // import { renderMdast } from '@app/lib/mdast/render' -import { matchType, renderMdast } from '@republik/mdast-react-render' +import { Metadata } from 'next' import Link from 'next/link' import { notFound } from 'next/navigation' -const schema = { - rules: [ - { - matchMdast: matchType('root'), - component: ({ children }) => children, - }, - ], +export async function generateMetadata({ + params: { path }, +}): Promise { + const client = await getClient() + const { data } = await client.query({ + query: ArticleDocument, + variables: { path: `/${path.join('/')}` }, + }) + + return { + title: data?.article?.meta.title, + } } -const renderSchema = (content) => renderMdast({ ...content }, schema) export default async function ArticlePage({ params: { path }, diff --git a/apps/www/src/app/rsc-artikel/layout.tsx b/apps/www/src/app/rsc-artikel/layout.tsx new file mode 100644 index 0000000000..860bbc1f7e --- /dev/null +++ b/apps/www/src/app/rsc-artikel/layout.tsx @@ -0,0 +1,20 @@ +import { PageLayout } from '@app/components/layout' +import { css } from '@app/styled-system/css' + +export default async function Layout(props: { children: React.ReactNode }) { + return ( +
+ +
+ {props.children} +
+
+
+ ) +}