tuchsoft/commonmark-ext-heading-shifter

A CommonMark extension to adjust (decrease) heading levels by a custom amount.

Installs: 86

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Type:commonmark-extension

pkg:composer/tuchsoft/commonmark-ext-heading-shifter

1.0.3 2025-07-17 11:42 UTC

This package is auto-updated.

Last update: 2025-10-17 13:15:30 UTC


README

License: MIT Copyright: Tuchsoft

CommonMark extension for shifting heading levels by a configurable amount of levels.

Install

composer require tuchsoft/commonmark-ext-heading-shifter

Usage

use League\CommonMark\CommonMarkConverter;
use League\CommonMark\Environment;
use TuchSoft\CommonMarkHeadingShifter\HeadingShifterExtension;

$converter = new CommonMarkConverter([
    'heading_shifter' => [
        'shift_by' => 1
        ]
    ]);

$converter->getEnvironment()->addExtension(new HeadingShifterExtension());

$converter->convertToHtml("# Heading"); //<h2>Heading</h2>

Author

👤 Mattia Bonzi @ TuchSoft mattia@tuchsoft.com

TuchSoft logo

🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.