function recurse()

in website/scripts/emoji.js [23:41]


  function recurse(node) {
    for (const child of node.children || []) {
      if (child.type === "text") {
        const content = replaceEmojis(child.data);

        // If we replace a text child, make sure that we scan this node again for more emojis
        if (content !== child.data) {
          $(child).replaceWith($.parseHTML(content));
          return recurse(node);
        }
      } else if (
        child.type === "tag" &&
        child.name !== "pre" &&
        child.name !== "code"
      ) {
        recurse(child);
      }
    }
  }