Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ueberdosis/commonmark-hint-extension

Render :::important Hints::: in league/commonmark
https://github.com/ueberdosis/commonmark-hint-extension

commonmark commonmark-extension markdown

Last synced: 7 days ago
JSON representation

Render :::important Hints::: in league/commonmark

Awesome Lists containing this project

README

        

> We need your support to maintain this package. 💖 https://github.com/sponsors/ueberdosis

# CommonMark Hint Extension

[![](https://img.shields.io/packagist/v/ueberdosis/commonmark-hint-extension.svg)](https://packagist.org/packages/ueberdosis/commonmark-hint-extension)
[![Tests](https://github.com/ueberdosis/commonmark-hint-extension/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/ueberdosis/commonmark-hint-extension/actions/workflows/test.yml)
[![](https://img.shields.io/packagist/dt/ueberdosis/commonmark-hint-extension.svg)](https://packagist.org/packages/ueberdosis/commonmark-hint-extension)
[![Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub)](https://github.com/sponsors/ueberdosis)

A hint extension for [league/commonmark](https://github.com/thephpleague/commonmark) that renders the following Markdown as HTML.

## Example

### Markdown
```md
:::important Warning!
This is how the **Markdown** looks.
:::
```

### HTML
```html



Warning!



This is how the Markdown looks.



```

## Installation

You can install the package via composer:

```bash
composer require ueberdosis/commonmark-hint-extension
```

## Usage

```php
addExtension(new CommonMarkCoreExtension());

// Add this extension
$environment->addExtension(new HintExtension());

// Instantiate the converter engine and start converting some Markdown!
$converter = new MarkdownConverter($environment);
$markdown = <<convertToHtml($markdown);
```

## Testing

```bash
composer test
```

## Credits

- [Hans Pagel](https://github.com/hanspagel)
- [All Contributors](../../contributors)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.