private function compileNode(Node $node) : string
    {
        if ($node->isLeaf()) {
            // Don't compile a leaf that is a tag because that means it doesn't have any content
            if ($node->isTag()) {
                return '';
            }

            return $node->getValue() ?: '';
        } else {
            $output = '';

            foreach ($node->getChildren() as $childNode) {
                if ($node->isTag()) {
                    if (!isset($this->elements[$node->getValue()])) {
                        throw new InvalidArgumentException("No style registered for element \"{$node->getValue()}\"");
                    }

                    $style = $this->elements[$node->getValue()];
                    $output .= $style->format($this->compileNode($childNode));
                } else {
                    $output .= $this->compileNode($childNode);
                }
            }

            return $output;
        }
    }