BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/prompt-kit/markdown

Markdown

prompt-kit-agents-ui/markdown
FreeComponent

A component for rendering Markdown content with support for code blocks, GFM, and custom styling

Install it

npx shadcn@latest add https://raw.githubusercontent.com/agents-ui/agents-kit/main/public/c/markdown.json

Source

markdown.tsxraw.githubusercontent.com/agents-ui/agents-kit/main/public/c/markdown.json
1import { cn } from "@/lib/utils"
2import { marked } from "marked"
3import { memo, useId, useMemo } from "react"
4import ReactMarkdown, { Components } from "react-markdown"
5import remarkBreaks from "remark-breaks"
6import remarkGfm from "remark-gfm"
7import { CodeBlock, CodeBlockCode } from "./code-block"
8
9export type MarkdownProps = {
10 children: string
11 id?: string
12 className?: string
13 components?: Partial<Components>
14}
15
16function parseMarkdownIntoBlocks(markdown: string): string[] {
17 const tokens = marked.lexer(markdown)
18 return tokens.map((token) => token.raw)
19}
20
21function extractLanguage(className?: string): string {
22 if (!className) return "plaintext"
23 const match = className.match(/language-(\w+)/)
24 return match ? match[1] : "plaintext"
25}
26
27const INITIAL_COMPONENTS: Partial<Components> = {
28 code: function CodeComponent({ className, children, ...props }) {
29 const isInline =
30 !props.node?.position?.start.line ||
31 props.node?.position?.start.line === props.node?.position?.end.line
32
33 if (isInline) {
34 return (
35 <span
36 className={cn(
37 "bg-primary-foreground rounded-sm px-1 font-mono text-sm",
38 className
39 )}
40 {...props}
41 >
42 {children}
43 </span>
44 )
45 }
46
47 const language = extractLanguage(className)
48
49 return (
50 <CodeBlock className={className}>
51 <CodeBlockCode code={children as string} language={language} />
52 </CodeBlock>
53 )
54 },
55 pre: function PreComponent({ children }) {
56 return <>{children}</>
57 },
58}
59
60const MemoizedMarkdownBlock = memo(
61 function MarkdownBlock({
62 content,
63 components = INITIAL_COMPONENTS,
64 }: {
65 content: string
66 components?: Partial<Components>
67 }) {
68 return (
69 <ReactMarkdown
70 remarkPlugins={[remarkGfm, remarkBreaks]}
71 components={components}
72 >
73 {content}
74 </ReactMarkdown>
75 )
76 },
77 function propsAreEqual(prevProps, nextProps) {
78 return prevProps.content === nextProps.content
79 }
80)
81
82MemoizedMarkdownBlock.displayName = "MemoizedMarkdownBlock"
83
84function MarkdownComponent({
85 children,
86 id,
87 className,
88 components = INITIAL_COMPONENTS,
89}: MarkdownProps) {
90 const generatedId = useId()
91 const blockId = id ?? generatedId
92 const blocks = useMemo(() => parseMarkdownIntoBlocks(children), [children])
93
94 return (
95 <div className={className}>
96 {blocks.map((block, index) => (
97 <MemoizedMarkdownBlock
98// … truncated

What it pulls in

npm packages

  • react-markdown
  • remark-gfm
  • shiki
  • marked

Files it writes

  • components/prompt-kit/markdown.tsx
  • components/prompt-kit/code-block.tsx

Facts

Registry
prompt-kit
Type
registry:ui
Access
Free
Files written
2
Licence
NOASSERTION
In the index
at or before 2026-08-12
Last confirmed
3 days ago

Go to the source

agents-ui.github.io agents-ui/agents-kit on GitHub Raw registry item This item as JSON

More from prompt-kit

All 12 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Chat Containerchat-containerprompt-kitComponentsFree1 dep
Code Blockcode-blockprompt-kitComponentsFree1 dep
File Uploadfile-uploadprompt-kitComponentsFreeno deps
Jsx Previewjsx-previewprompt-kitComponentsFree1 dep
Loaderloaderprompt-kitComponentsFreeno deps
Messagemessageprompt-kitComponentsFree5 deps · 3 files
Prompt Inputprompt-inputprompt-kitComponentsFreeno deps
Prompt Suggestionprompt-suggestionprompt-kitComponentsFree2 deps

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex