<?php
// pages/components/markdown_guide_demo.php
// Demo/dev component: render a Markdown file as a collapsible FAQ/Guide
// All inline HTML is captured via output buffering as per project guidelines

$file = (string)mh_get('file', 'build.md', 'string');
$headingLevel = (int)mh_get('h', 2, 'int');
$openFirst = (bool)mh_get('open_first', 1, 'int');

ob_start();
?>
<div class="p-4">
    <div class="mb-4">
        <div class="text-sm text-secondary/70">Markdown Guide Demo</div>
        <div class="mt-1 text-xs text-secondary/60">
            Params: <code class="font-mono">?file=build.md&amp;h=2&amp;open_first=1</code>
        </div>
    </div>

    <?= \Components\Ui\MarkdownGuide::renderFromFile($file, [
        'baseDir' => defined('BEEZUI_ROOT') ? (string)BEEZUI_ROOT : getcwd(),
        'headingLevel' => $headingLevel,
        'openFirst' => $openFirst,
        'title' => $file,
        'idPrefix' => 'mdg-demo',
        'showControls' => true,
    ]) ?>
</div>
<?php
echo ob_get_clean();
