Markdown Check

Catches Markdown that will render differently from how it reads, like an unclosed ** or a link broken by a space, and previews each spot.

StopsMarkdown renders differently than written

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/markdown-check.json

The files land in your project. They're yours to edit.

Usage

markdown-check-usage.tsx
import { MarkdownCheck } from "@/components/ui/markdown-check"

return <MarkdownCheck label="Release notes" defaultValue={draft} rows={5} className="max-w-sm" />

What it catches

  • Unclosed emphasis or code backticks
  • [text] (url) with a space, and empty or space-broken links
  • #Title with no space after #
  • Raw HTML tags your sanitizer strips (allowedTags)

Props

MarkdownCheck props
PropTypeDefault
label

Visible label.

string"Description"
hint

Helper text shown while there is nothing to warn about.

string"Markdown supported."
value

Controlled value.

string—
defaultValue

Initial value when uncontrolled.

string""
onValueChange

Called with the text on every change, including one-tap fixes.

(value: string) => void—
allowedTags

HTML tags the renderer keeps. Others are flagged as stripped.

string[]DEFAULT_ALLOWED_TAGS
delay

Pause in ms before problems show while typing. Leaving the field shows them at once.

number600
maxShown

How many problem spots are previewed at once.

number3
summary

Heading of the preview list; `{count}` is filled in.

string"{count} will render wrong"
validMessage

Shown when nothing will render wrong.

string"Renders as written"
fixLabels

Labels of the one-tap fixes, per mistake.

Partial<Record<MarkdownMistake, string>>—
showLabel

Text of the button that selects the spot in the textarea.

string"Show"
moreLabel

Shown when more spots exist than `maxShown`; `{count}` is filled in.

string"+{count} more"

* required. Also accepts the native props of <textarea> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Visible label; textarea is described by a polite status region
  • Problems wait for a pause while typing and show at once on blur
  • Each issue has a select button and a fix button

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

  • Follows CommonMark/GitHub-style rules; other renderers differ
  • Not a full Markdown parser, so nested edge cases can be missed
  • Default allowed tags mirror GitHub-style sanitizers; pass yours

What it stops

Markdown renders differently than written

Also known as

markdown · md editor · readme · comment box · rich text · preview · github markdown · docs

Field type

Dependencies

Pairs well with