Skip to content

Commit ccdfe67

Browse files
committed
Allow html in markdown
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
1 parent fc4891c commit ccdfe67

File tree

6 files changed

+189
-5
lines changed

6 files changed

+189
-5
lines changed

apps/console/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"react-markdown": "^10.1.0",
4545
"react-relay": "^18.2.0",
4646
"react-router": "^7.1.5",
47+
"rehype-raw": "^7.0.0",
4748
"relay-runtime": "^18.2.0",
4849
"remark-gfm": "^4.0.1",
4950
"tailwind-merge": "^3.0.2",

apps/console/src/pages/SigningRequestsPage.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
import { Progress } from "@/components/ui/progress";
1515
import ReactMarkdown from "react-markdown";
1616
import remarkGfm from "remark-gfm";
17+
import rehypeRaw from 'rehype-raw';
1718

1819
type Document = {
1920
policy_version_id: string;
@@ -241,7 +242,8 @@ export default function SigningRequestsPage() {
241242
<CardContent>
242243
<div className="border rounded-md p-4 min-h-[400px] bg-muted/20">
243244
<div className="prose prose-olive max-w-none">
244-
<ReactMarkdown remarkPlugins={[remarkGfm]}>
245+
<ReactMarkdown remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeRaw]}
246+
>
245247
{currentDoc.content}
246248
</ReactMarkdown>
247249
</div>

apps/console/src/pages/organizations/measures/MeasureView.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ import { MeasureViewRisksQuery$data } from "./__generated__/MeasureViewRisksQuer
108108
import { MeasureViewRisksQuery } from "./__generated__/MeasureViewRisksQuery.graphql";
109109
import { MeasureViewDeleteMeasureMutation } from "./__generated__/MeasureViewDeleteMeasureMutation.graphql";
110110
import remarkGfm from "remark-gfm";
111+
import rehypeRaw from "rehype-raw";
111112

112113
// Function to format ISO8601 duration to human-readable format
113114
const formatDuration = (isoDuration: string): string => {
@@ -2201,7 +2202,7 @@ function MeasureViewContent({
22012202
<Card className="mt-4">
22022203
<CardContent className="pt-6">
22032204
<div className="prose prose-gray prose-sm md:prose-base text-secondary max-w-3xl">
2204-
<ReactMarkdown remarkPlugins={[remarkGfm]}>
2205+
<ReactMarkdown remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeRaw]}>
22052206
{data.measure.description}
22062207
</ReactMarkdown>
22072208
</div>
@@ -2831,7 +2832,7 @@ function MeasureViewContent({
28312832
Description
28322833
</h3>
28332834
<div className="prose prose-gray prose-sm max-w-none text-primary bg-invert-bg p-4 rounded-md border border-mid-b">
2834-
<ReactMarkdown remarkPlugins={[remarkGfm]}>
2835+
<ReactMarkdown remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeRaw]}>
28352836
{selectedTask.description}
28362837
</ReactMarkdown>
28372838
</div>

apps/console/src/pages/organizations/policies/ShowPolicyView.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import {
4242
} from "@/components/ui/dialog";
4343
import { SignaturesModal } from "./SignaturesModal";
4444
import { VersionHistoryModal } from "./VersionHistoryModal";
45+
import rehypeRaw from "rehype-raw";
4546

4647
const policyViewQuery = graphql`
4748
query ShowPolicyViewQuery($policyId: ID!) {
@@ -376,7 +377,7 @@ function ShowPolicyContent({
376377
)}
377378

378379
<div className="prose prose-olive max-w-none">
379-
<ReactMarkdown remarkPlugins={[remarkGfm]}>
380+
<ReactMarkdown remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeRaw]}>
380381
{latestVersionNode.content || "No content available"}
381382
</ReactMarkdown>
382383
</div>

apps/console/src/pages/organizations/policies/VersionHistoryModal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import ReactMarkdown from "react-markdown";
77
import { graphql, useFragment } from "react-relay";
88
import type { VersionHistoryModal_policyVersions$key } from "./__generated__/VersionHistoryModal_policyVersions.graphql";
99
import remarkGfm from "remark-gfm";
10+
import rehypeRaw from "rehype-raw";
1011

1112
export const policyVersionsFragment = graphql`
1213
fragment VersionHistoryModal_policyVersions on Policy {
@@ -133,7 +134,7 @@ export function VersionHistoryModal({
133134

134135
<div className="prose prose-olive max-w-none">
135136
{selectedVersion && (
136-
<ReactMarkdown remarkPlugins={[remarkGfm]}>
137+
<ReactMarkdown remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeRaw]}>
137138
{versions.find((v) => v.version === selectedVersion)
138139
?.content || "No content available"}
139140
</ReactMarkdown>

package-lock.json

Lines changed: 178 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)