Skip to main content

parser

caution

All props/parameters are optional unless they are marked with an asterisk ( * ).

Props

NameTypeDescription
defaultRulesDefaultRulesIncludes a list of default rules used by the parser
guildEventRulesDefaultRulesIncludes a list of default rules for guild events used by the parser
notifCenterV2MessagePreviewRulesDefaultRulesIncludes a list of default rules for the new notification center used by the parser

Functions

NameParametersReturn TypeDescription
astParserFor* rules: ParserRules(...) => ReactElementCreates a new AST parser function based on specific rules; the returned function has the same parameters of the other parser functions
parsetext: string
inline: boolean
opts: ParseOptions
postProcess: (tree: unknown, inline: boolean) => void
ReactElementConverts a markdown string to React elements
parseAutoModerationSystemMessagetext: string
inline: boolean
opts: ParseOptions
postProcess: (tree: unknown, inline: boolean) => void
ReactElementparse function but highlights text defined in highlightText parse option
parseAutoModerationSystemMessageToASTtext: string
inline: boolean
opts: ParseOptions
postProcess: (tree: unknown, inline: boolean) => void
ReactElementparseToAST function but highlights text defined in highlightText parse option
parseEmbedTitletext: string
inline: boolean
opts: ParseOptions
postProcess: (tree: unknown, inline: boolean) => void
ReactElementparse function but with codeBlock, br, mention, channel and roleMention rules omitted
parseEmbedTitleToASTtext: string
inline: boolean
opts: ParseOptions
postProcess: (tree: unknown, inline: boolean) => void
ReactElementparseToAST function but with codeBlock, br, mention, channel and roleMention rules omitted
parseForumPostGuidelinestext: string
inline: boolean
opts: ParseOptions
postProcess: (tree: unknown, inline: boolean) => void
ReactElementparse function but with paragraph and newline rules omitted
parseForumPostMostRecentMessagetext: string
inline: boolean
opts: ParseOptions
postProcess: (tree: unknown, inline: boolean) => void
ReactElementparse function but with some emoji sizing changes and blockQuote, codeBlock and br rules omitted
parseGuildEventDescriptiontext: string
inline: boolean
opts: ParseOptions
postProcess: (tree: unknown, inline: boolean) => void
ReactElementparse function but with codeBlock, blockQuote and br rules omitted
parseGuildVerificationFormRuletext: string
inline: boolean
opts: ParseOptions
postProcess: (tree: unknown, inline: boolean) => void
ReactElementparse function but with codeBlock, br and blockQuote rules omitted
parseInlineReplytext: string
inline: boolean
opts: ParseOptions
postProcess: (tree: unknown, inline: boolean) => void
ReactElementparse function but with blockQuote, codeBlock and br rules omitted
parseInlineReplyToASTtext: string
inline: boolean
opts: ParseOptions
postProcess: (tree: unknown, inline: boolean) => void
ReactElementparseToAST function but with blockQuote, codeBlock and br rules omitted
parseToASTtext: string
inline: boolean
opts: ParseOptions
postProcess: (tree: unknown, inline: boolean) => void
ReactElementConverts a markdown string to AST
parseTopictext: string
inline: boolean
opts: ParseOptions
postProcess: (tree: unknown, inline: boolean) => void
ReactElementparse function but with inlineCode, codeBlock, br and blockQuote rules omitted
parseTopicToASTtext: string
inline: boolean
opts: ParseOptions
postProcess: (tree: unknown, inline: boolean) => void
ReactElementparseToAST function but with inlineCode, codeBlock, br and blockQuote rules omitted
reactParserFor* rules: ParserRules(...) => ReactElementCreates a new parser function based on specific rules; the returned function has the same parameters of the other parser functions

Types

ParseOptions

NameTypeDescription
allowHeadingbooleanWhether headings are allowed
allowLinksbooleanWhether links are allowed
allowListbooleanWhether lists are allowed
channelIdstringChannel id of where the string is located
disableAnimatedEmojibooleanWhether animated emojis are disabled
disableAutoBlockNewlinesbooleanWhether new lines are not added at the end
formatInlinebooleanWhether headings and lists should all be inline
highlightWordstringWord to highlight
isInteractingbooleanWhether the string is interacted with
mentionChannelsstring[]Ids of the mentioned channels
noStyleAndInteractionbooleanWhether interactions and style are not applied
previewLinkTargetbooleanWhether to preview real URL on hover
returnMentionIdsbooleanWhether mention ids should be returned