Parser
Index
Constructors
constructor
Properties
allowed
banned
blocked
optionalcontainer
content
filters
keyIndex
matchers
props
Methods
applyAttributeFilters
Type parameters
- K: keyof ElementAttributes
applyMatchers
Loop through and apply all registered matchers to the string. If a match is found, create a React element, and build a new array. This array allows React to interpolate and render accordingly.
applyNodeFilters
Loop through and apply all registered node filters.
canRenderChild
Determine whether the child can be rendered within the parent.
convertLineBreaks
Convert line breaks in a string to HTML
<br/>
tags. If the string contains HTML, we should not convert anything, as line breaks should be handled by<br/>
s in the markup itself.
createContainer
Create a detached HTML document that allows for easy HTML parsing while not triggering scripts or loading external resources.
extractAttributes
Convert an elements attribute map to an object map. Returns null if no attributes are defined.
extractStyleAttribute
Extract the style attribute as an object and remove values that allow for attack vectors.
getTagConfig
Return configuration for a specific tag.
isSafe
Verify that a node is safe from XSS and injection attacks.
isTagAllowed
Verify that an HTML tag is allowed to render.
parse
Parse the markup by injecting it into a detached document, while looping over all child nodes and generating an array to interpolate into JSX.
parseNode
Loop over the nodes children and generate a list of text nodes and React elements.
replaceTokens
Deconstruct the string into an array, by replacing custom tokens with React elements, so that React can render it correctly.
Loop through and apply all registered attribute filters.