tuchsoft/commonmark-ext-heading-shifter

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

Maintainers

Package info

github.com/TuchSoft/commonmark-ext-heading-shifter

Issues

Type:commonmark-extension

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

Statistics

Installs: 296

Dependents: 0

Suggesters: 0

Stars: 1

1.0.3 2025-07-17 11:42 UTC

This package is auto-updated.

Last update: 2026-04-17 14:21:27 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.