From 5ea451f63ddeb071acdd6175c27fd4fda554d7fe Mon Sep 17 00:00:00 2001 From: DrMint Date: Tue, 8 Feb 2022 17:34:17 +0100 Subject: [PATCH] Added support for markdown --- package-lock.json | 18 ++++++++++++++++++ package.json | 1 + src/pages/content/[slug]/index.tsx | 4 +++- src/pages/content/[slug]/read.tsx | 14 ++++++++++---- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6393481..cac3422 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "@fontsource/material-icons-rounded": "^4.5.0", "@fontsource/vollkorn": "^4.5.1", "@fontsource/zen-maru-gothic": "^4.5.3", + "markdown-to-jsx": "^7.1.6", "next": "^12.0.7", "react": "17.0.2", "react-dom": "17.0.2" @@ -2743,6 +2744,17 @@ "node": ">=10" } }, + "node_modules/markdown-to-jsx": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/markdown-to-jsx/-/markdown-to-jsx-7.1.6.tgz", + "integrity": "sha512-1wrIGZYwIG2gR3yfRmbr4FlQmhaAKoKTpRo4wur4fp9p0njU1Hi7vR8fj0AUKKIcPduiJmPprzmCB5B/GvlC7g==", + "engines": { + "node": ">= 10" + }, + "peerDependencies": { + "react": ">= 0.14.0" + } + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -6081,6 +6093,12 @@ "yallist": "^4.0.0" } }, + "markdown-to-jsx": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/markdown-to-jsx/-/markdown-to-jsx-7.1.6.tgz", + "integrity": "sha512-1wrIGZYwIG2gR3yfRmbr4FlQmhaAKoKTpRo4wur4fp9p0njU1Hi7vR8fj0AUKKIcPduiJmPprzmCB5B/GvlC7g==", + "requires": {} + }, "merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", diff --git a/package.json b/package.json index 18d2cfe..49a507c 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "@fontsource/material-icons-rounded": "^4.5.0", "@fontsource/vollkorn": "^4.5.1", "@fontsource/zen-maru-gothic": "^4.5.3", + "markdown-to-jsx": "^7.1.6", "next": "^12.0.7", "react": "17.0.2", "react-dom": "17.0.2" diff --git a/src/pages/content/[slug]/index.tsx b/src/pages/content/[slug]/index.tsx index b8a5aff..8056e0b 100644 --- a/src/pages/content/[slug]/index.tsx +++ b/src/pages/content/[slug]/index.tsx @@ -7,6 +7,8 @@ import Image from "next/image"; import { getAssetURL, prettySlug } from "queries/helpers"; import Button from "components/Button"; import HorizontalLine from "components/HorizontalLine"; +import SubPanel from "components/Panels/SubPanel"; +import ReturnButton from "components/PanelComponents/ReturnButton"; type Props = { content: GetContentQuery; @@ -24,7 +26,7 @@ export default function Library(props: Props): JSX.Element { <>
-
+
+ + +
-
+
{content.text_set.length > 0 ? ( -
- {content.text_set[0].text} +
+ {content.text_set[0].text}
) : ( ""