public function render()
    {
        $environment = $this->parser->getEnvironment();
        $span = $this->process($this->span);

        // Replacing tokens
        if ($this->tokens) {
            foreach ($this->tokens as $id => $value) {
                switch ($value['type']) {
                case 'raw':
                    $span = str_replace($id, $value['text'], $span);
                    break;
                case 'literal':
                    $span = str_replace($id, $this->literal($value['text']), $span);
                    break;
                case 'reference':
                    $reference = $environment->resolve($value['section'], $value['url']);
                    $link = $this->reference($reference, $value);

                    $span = str_replace($id, $link, $span);
                    break;
                case 'link':
                    if ($value['url']) {
                        if ($environment->useRelativeUrls()) {
                            $url = $environment->relativeUrl($value['url']);
                        } else {
                            $url = $value['url'];
                        }
                    } else {
                        $url = $environment->getLink($value['link']);
                    }
                    $link = $this->link($url, $this->process($value['link']));
                    $span = str_replace($id, $link, $span);
                    break;
                }
            }
        }

        return $span;
    }