Props

Common Props for DsMarkdown and MarkdownCMD

PropTypeDescriptionDefault
intervalnumber | IntervalConfigTyping interval configuration, supports fixed interval or dynamic speed control30
timerType'setTimeout' | 'requestAnimationFrame'Timer type, cannot be modified dynamically'setTimeout'
answerTypeAnswerTypeContent type (affects style theme), cannot be modified dynamically'answer'
themeThemeTheme type'light'
pluginsIMarkdownPlugin[]Plugin configuration[]
mathIMarkdownMathMath formula configuration{ splitSymbol: 'dollar' }
showCursorbooleanWhether to show cursor during typing animationfalse
cursorReact.ReactNode | 'line' | 'block' | 'underline' | 'circle'Custom cursor element or built-in cursor type'line' (when showCursor is true)
onEnd(data?: IEndData) => voidTyping completion callback-
onStart(data?: IStartData) => voidTyping start callback-
onBeforeTypedChar(data?: IBeforeTypedChar) => Promise<void>Callback before character typing, supports async operations, will block subsequent typing-
onTypedChar(data?: ITypedChar) => voidCallback after each character is typed-
disableTypingbooleanDisable typing animation effectfalse
autoStartTypingbooleanWhether to automatically start typing animation, set to false for manual trigger, cannot be modified dynamicallytrue
codeBlockIMarkdownCodeCode block configuration{headerActions: true}

DsMarkdown Specific Props

PropTypeDescriptionDefault
childrenstring | undefinedMarkdown content-

MarkdownCMD Specific Props

MarkdownCMD does not require a children prop. Content is added dynamically through the push() method.

Usage Examples

Basic Configuration

<DsMarkdown 
  interval={20}
  theme="dark"
  answerType="answer"
  showCursor
  cursor="block"
>
  # Content
</DsMarkdown>

Dynamic Speed Control

<DsMarkdown 
  interval={{
    min: 10,
    max: 50,
    curve: 'ease-out'
  }}
>
  Content...
</DsMarkdown>

Callback Functions

<DsMarkdown
  onStart={(data) => console.log('Started', data)}
  onEnd={(data) => console.log('Completed', data)}
  onTypedChar={(data) => console.log('Typed', data)}
>
  Content...
</DsMarkdown>