CommonMark extension for shifting heading levels
Find a file
2025-07-17 14:44:49 +02:00
src fix: Update package name and references in README.md and composer.json 2025-07-17 13:42:39 +02:00
.gitignore Create .gitignore 2025-07-14 16:23:15 +02:00
composer.json fix: Update package name and references in README.md and composer.json 2025-07-17 13:42:39 +02:00
LICENSE Initial commit 2025-07-14 15:49:13 +02:00
README.md docs: Add copyright badge for Tuchsoft in README.md 2025-07-17 14:44:49 +02:00

commonmark-ext-heading-shifter

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.