From 2907086400719471f88ef14d06f3e8f0f292d16a Mon Sep 17 00:00:00 2001
From: xaralis <filip.varecha@fragaria.cz>
Date: Mon, 4 Jan 2021 08:57:37 +0100
Subject: [PATCH] feat: render program entry description as markdown

---
 src/pages/Program.jsx | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/pages/Program.jsx b/src/pages/Program.jsx
index 0ed75f8..40b8f4d 100644
--- a/src/pages/Program.jsx
+++ b/src/pages/Program.jsx
@@ -8,6 +8,7 @@ import Button from "components/Button";
 import Chip from "components/Chip";
 import ModalConfirm from "components/modals/ModalConfirm";
 import { useActionState, useItemActionConfirm } from "hooks";
+import { markdownConverter } from "markdown";
 import { AuthStore, ProgramStore } from "stores";
 
 const Schedule = () => {
@@ -49,6 +50,11 @@ const Schedule = () => {
             const isCurrent = id === currentId;
             const entry = items[id];
             const fullTitle = `${entry.number}. ${entry.title}`;
+            const htmlContent = !!entry.description
+              ? {
+                  __html: markdownConverter.makeHtml(entry.description),
+                }
+              : null;
             return (
               <div
                 className="flex flex-col md:flex-row my-4 duration-300 text-black"
@@ -78,10 +84,11 @@ const Schedule = () => {
                     <strong>Navrhovatel:</strong>
                     <span>{entry.proposer}</span>
                   </div>
-                  {entry.description && (
-                    <p className="mt-2 leading-tight max-w-3xl">
-                      {entry.description}
-                    </p>
+                  {htmlContent && (
+                    <div
+                      className="mt-2 leading-tight max-w-3xl content-block"
+                      dangerouslySetInnerHTML={htmlContent}
+                    />
                   )}
                   {isAuthenticated &&
                     user.role === "chairman" &&
-- 
GitLab