One directive, fully accessible tabbed UI, zero JavaScript to write. @tabs / @tab / @endtabs markers are parsed into proper ARIA tablist, tab, and tabpanel roles with a self-contained switching script included. The cleanest path from markdown syntax to an interactive UI component in the PHP CommonMark ecosystem.
composer require alto/commonmarkuse Alto\CommonMark\Extension\Tabs\TabsExtension;
use League\CommonMark\Environment\Environment;
$environment = new Environment();
$environment->addExtension(new TabsExtension());@tabs
@tab "PHP"
```php
<?php echo 'Hello';
```
@tab "JavaScript"
```js
console.log('Hello');
```
@endtabs- Constructor accepts keys:
container_class,tabs_class,tab_class,panel_class,active_class,generate_ids. - Default output includes ARIA roles (
tablist,tab,tabpanel).
@tabs
@tab "Overview"
Project overview.
@tab "Install"
composer require vendor/package
@endtabsThis extension is actively developed in the alto/commonmark monorepo.
MIT License -- Simon André & Alto