Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Render markdown tables on partner landing pages (#4344)

Pedro Ladeira76d5c1a408b9
diff --git a/apps/web/lib/ai/generate-lander.ts b/apps/web/lib/ai/generate-lander.ts
index ffcdb8d405..7d26807b4c 100644
--- a/apps/web/lib/ai/generate-lander.ts
+++ b/apps/web/lib/ai/generate-lander.ts
@@ -118,7 +118,8 @@ export const generateLanderAction = authActionClient
`Do not add any file blocks. ` +
`For image blocks, make sure the image URL is an absolute URL, not a relative URL (append the website URL to the image URL if it's a relative URL). ` +
`If you have product pricing information, ${landerData ? "you could" : "you should"} include an earnings calculator block, using the highest non-enterprise tier for the product price. ` +
- `Markdown is supported in "text" blocks, but use it sparingly. ` +
+ `Markdown is supported in "text" and "accordion" blocks, but use it sparingly. ` +
+ `GFM tables are supported in those blocks (pipe tables with one row per line) and should be used for structured data. ` +
`Avoid using links. Relevant CTA links are already on the landing page. ` +
// Additional instructions
(prompt
diff --git a/apps/web/ui/partners/groups/design/lander/modals/text-block-modal.tsx b/apps/web/ui/partners/groups/design/lander/modals/text-block-modal.tsx
index 66bbd80a13..26ee2a90eb 100644
--- a/apps/web/ui/partners/groups/design/lander/modals/text-block-modal.tsx
+++ b/apps/web/ui/partners/groups/design/lander/modals/text-block-modal.tsx
@@ -107,7 +107,7 @@ function TextBlockModalInner({
/>
</div>
<a
- href="https://www.markdownguide.org/basic-syntax/"
+ href="https://www.markdownguide.org/extended-syntax/#tables"
target="_blank"
rel="noopener noreferrer"
className="text-content-subtle mt-1 flex items-center gap-1 text-xs"
diff --git a/apps/web/ui/partners/lander/blocks/block-markdown.tsx b/apps/web/ui/partners/lander/blocks/block-markdown.tsx
index 5ab9ec2ffb..041f0e9a40 100644
--- a/apps/web/ui/partners/lander/blocks/block-markdown.tsx
+++ b/apps/web/ui/partners/lander/blocks/block-markdown.tsx
@@ -1,5 +1,6 @@
import { cn } from "@dub/utils";
import Markdown from "react-markdown";
+import remarkGfm from "remark-gfm";
export function BlockMarkdown({
className,
@@ -20,10 +21,26 @@ export function BlockMarkdown({
dir="auto"
>
<Markdown
+ remarkPlugins={[remarkGfm]}
components={{
a: ({ node, ...props }) => (
<a {...props} target="_blank" rel="noopener noreferrer" />
),
+ table: ({ node, className, ...props }) => (
+ <div className="my-6 max-w-full overflow-x-auto rounded-xl border border-neutral-200">
+ <table
+ className={cn(
+ "my-0 w-full border-separate border-spacing-0 text-left text-[0.95rem]",
+ "[&_th]:border-b [&_th]:border-r [&_th]:border-neutral-200 [&_th]:bg-neutral-50 [&_th]:!px-4 [&_th]:py-3 [&_th]:align-top [&_th]:font-semibold [&_th]:text-neutral-900",
+ "[&_td]:border-b [&_td]:border-r [&_td]:border-neutral-200 [&_td]:!px-4 [&_td]:py-3 [&_td]:align-top [&_td]:text-neutral-600",
+ "[&_td:last-child]:border-r-0 [&_th:last-child]:border-r-0",
+ "[&>:last-child>tr:last-child>*]:border-b-0",
+ className,
+ )}
+ {...props}
+ />
+ </div>
+ ),
}}
>
{children}