pretext-md
inferencesh/pretext-mdFreeBlock
Measured markdown renderer powered by pretext. DOM-free text measurement, plugin architecture, virtualizable.
Install it
npx shadcn@latest add https://ui.inference.sh/r/pretext-md.jsonSource
1'use client'23import { createContext, useContext } from 'react'4import type { FontConfig, LineHeightConfig } from '../core/types'56export type PretextMdConfig = {7 fonts: FontConfig8 lineHeights: LineHeightConfig9}1011// Font strings use rem matching the app theme scale (--text-sm: 0.9rem, etc.).12// The inline layout engine resolves rem→px before passing to canvas measureText.13const defaultFonts: FontConfig = {14 body: '0.9rem "Mona Sans", sans-serif',15 bold: 'bold 0.9rem "Mona Sans", sans-serif',16 italic: 'italic 0.9rem "Mona Sans", sans-serif',17 boldItalic: 'bold italic 0.9rem "Mona Sans", sans-serif',18 code: '0.8rem "DM Mono", "Fira Code", monospace',19 h1: '1.8rem "Sentient", serif',20 h2: '1.5rem "Sentient", serif',21 h3: '1.15rem "Sentient", serif',22 h4: '0.9rem "Sentient", serif',23 h5: '0.8rem "Sentient", serif',24 h6: '0.8rem "Sentient", serif',25}2627const defaultLineHeights: LineHeightConfig = {28 body: 20,29 code: 18,30 h1: 32,31 h2: 28,32 h3: 24,33 h4: 20,34 h5: 20,35 h6: 18,36}3738export const defaultConfig: PretextMdConfig = {39 fonts: defaultFonts,40 lineHeights: defaultLineHeights,41}4243export const PretextMdContext = createContext<PretextMdConfig>(defaultConfig)4445export function usePretextMdConfig(): PretextMdConfig {46 return useContext(PretextMdContext)47}
What it pulls in
npm packages
Other registry items
More from inferencesh
All 14 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Agent Chatagent | inferencesh | Blocks | Free | 1 dep | |
| Chat UI Primitiveschat | inferencesh | Blocks | Free | 1 dep | |
| Code Blockcode-block | inferencesh | Blocks | Free | no deps | |
| Markdown Renderer (legacy)markdown | inferencesh | Blocks | Free | 2 deps | |
| Sidebar Lightsidebar-light | inferencesh | Blocks | Free | no deps | |
| Stepssteps | inferencesh | Blocks | Free | no deps | |
| Table of Contentstable-of-contents | inferencesh | Blocks | Free | no deps | |
| Tasktask | inferencesh | Blocks | Free | 1 dep |
