PHPackages                             jsw/commonmark-figure-extension - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. jsw/commonmark-figure-extension

ActiveCommonmark-extension[Parsing &amp; Serialization](/categories/parsing)

jsw/commonmark-figure-extension
===============================

League/commonmark extension for HTML figure and caption.

1.2.0(2y ago)21.4k2[2 issues](https://github.com/JanStanleyWatt/commonmark-figure-extension/issues)1Apache-2.0PHP

Since Mar 8Pushed 2y ago1 watchersCompare

[ Source](https://github.com/JanStanleyWatt/commonmark-figure-extension)[ Packagist](https://packagist.org/packages/jsw/commonmark-figure-extension)[ RSS](/packages/jsw-commonmark-figure-extension/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (1)

Commonmark Figure Extension
===========================

[](#commonmark-figure-extension)

[League\\CommonMark](https://github.com/thephpleague/commonmark) extension for HTML diagrams and captions inspired by [Markdig](https://github.com/xoofx/markdig).

Installation
------------

[](#installation)

```
$ composer require jsw/commonmark-figure-extension
```

Usage
-----

[](#usage)

- Fence the top and bottom of the sentence you want to be a figure with `^` like a code block
- Continued text in bottom fence becomes figure caption
- Even if the number of upper and lower `^` is different, it will be processed normally

```
$environment = new Environment();
$environment->addExtension(new CommonMarkCoreExtension());
            ->addExtension(new FigureExtension());

$converter = new MarkdownConverter($environment);

$markdown =
