MCPcopy Create free account
hub / github.com/codecombat/codecombat / processText

Function processText

ozaria/engine/cinematic/dialogsystem/helper.js:16–29  ·  view source on GitHub ↗
(dialogNode, context)

Source from the content-addressed store, hash-verified

14 * @returns {HTMLElement|undefined} The processed element.
15 */
16export function processText (dialogNode, context) {
17 let text = utils.i18n(dialogNode, 'text')
18 try {
19 text = tmpl(text || '', context)
20 } catch (err) {
21 console.warn("Couldn't process text template:", err, { dialogNode, text, context })
22 }
23 if (!text) {
24 return undefined
25 }
26
27 const newText = decodeHtml(marked(text))
28 return wrapText(`<div>${newText}</div>`)
29}
30
31/**
32 * Converts a string such as "3 &lt; 2" into "3 < 2".

Callers 2

parseDialogNodeMethod · 0.90

Calls 2

decodeHtmlFunction · 0.85
wrapTextFunction · 0.85

Tested by

no test coverage detected