Changes from V5:
scrollFriendly flag to init, which enables a mode where:Messages used by highlighter when interacting with a mouse or finger.
Messages used by highlighter when interacting with a touch screen.
Messages used by highlighter when interaction with the keyboard.
Setup initial model
joinAdjacentInteractiveHighlights - When true, and static highlightables are sandwiched by highlighted interactive highlightables of the same type, apply the highlight to the static highlightable as well.
scrollFriendly - When true, enables a mode where mobile highlighting requires long-press instead of tap to highlight, and desktop highlighting requires double-click instead of single-click to highlight a single word.
Update for highlighter returning additional info about whether there was a change
Same as view, but will render strings like "blah" inside of emphasis tags.
WARNING: the version of markdown used here is extremely limited, as the highlighter content needs to be entirely in-line content. Lists & other block-level elements will not render as they usually would!
WARNING: markdown is rendered highlightable by highlightable, so be sure to provide highlightables like ["New York Times"]["New York Times"], NOT like ["New ", "York ", "Times"]["New ", "York ", "Times"]
Same as static, but will render strings like "blah" inside of emphasis tags.
WARNING: the version of markdown used here is extremely limited, as the highlighter content needs to be entirely in-line content. Lists & other block-level elements will not render as they usually would!
WARNING: markdown is rendered highlightable by highlightable, so be sure to provide highlightables like ["New York Times"]["New York Times"], NOT like ["New ", "York ", "Times"]["New ", "York ", "Times"]
Same as staticWithTags, but will render strings like "blah" inside of emphasis tags.
WARNING: the version of markdown used here is extremely limited, as the highlighter content needs to be entirely in-line content. Lists & other block-level elements will not render as they usually would!
WARNING: markdown is rendered highlightable by highlightable, so be sure to provide highlightables like ["New York Times"]["New York Times"], NOT like ["New ", "York ", "Times"]["New ", "York ", "Times"]
If you want more control over the rendering of the highlightables, you can use these functions inside of a fold to
render the highlightables one by one. Use initFoldState to set up the initial state and then each call to viewFoldHighlighter
or viewFoldStatic will render a single highlightable along with an update to the state.
A type that contains information needed to render individual Highlightables one at a time
Computes all the mark styles necessary to perform a fold over the Highlightable elements
Render a single Highlightable while also returning an updated state.
A list of extraStyles is also accepted if, for example, you want to apply bold / italic / underline formatting to the generated span.
Render a single Highlightable that is NOT interactive while also returning an updated state.
A list of extraStyles is also accepted if, for example, you want to apply bold / italic / underline formatting to the generated span.
Possible intents or "external effects" that the Highlighter can request (see perform).
Check if the highlighter has changed.
Communicates whether a change to a highlightable has been performed
Describes the change being performed by the Highlighter component, alongside the index bounds of the change
You are not likely to need this helper unless you're working with inline commenting.
You are not likely to need this helper unless you're working with inline commenting.
Highlights can overlap. Sometimes, we want to apply a certain behavior (e.g., hover color change) on just the shortest highlight. Use this function to find out which marker applies to the least amount of text.
Note that this is shortest by text length, not shortest by number of highlightables.
You are not likely to need this helper unless you're working with inline commenting.
Select the shortest possibly-overlapping marker covering the index provided, return its range.
Model of a highlighter