Пример #1
0
    public function render(Node $node, $showCode = false, $wrapInIframe = true)
    {
        $fileContent = file_get_contents($node->getFile());
        if (!$wrapInIframe) {
            return $fileContent;
        }
        $fileContent = htmlentities($fileContent, ENT_QUOTES);
        $str = '<iframe src="index.php?iframe=1&p=' . $node->getFullPath() . '" onload="this.style.height=this.contentDocument.body.scrollHeight +\'px\';" class="iframe"></iframe>';
        if ($showCode) {
            $str .= <<<EOL
                <br/><br/>
                <div class="accordion" data-component="Application/Components/StyleguideAccordion">
                    <header class="accordion__header">Code</header>
                    <div class="accordion__content">
                        <pre class="code">
                            <div class="button button--copy tooltip" data-clipboard-target="#{$node->getName()}"><img src="assets/default/images/svg/clippy.svg" alt="Copy to clipboard"></div>
                            <code>{$fileContent}</code>
                        </pre>
                    </div>
                </div>
EOL;
        }
        return $str;
    }
Пример #2
0
 public function render(Node $node, $showCode = false, $wrapInIframe = false)
 {
     $parser = new \Parsedown();
     return '<div class="content">' . $parser->parse(file_get_contents($node->getFile())) . '</div>';
 }