Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
noah1400 authored Oct 9, 2022
1 parent 3421f9c commit c6761d4
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,34 @@
# commonmark-picture-extension
Adds support of picture tags to CommonMark PHP implementation
# n0sz/commonmark-picture-extension
This library adds support of `<picture>` tags to [league/commonmark](https://github.com/thephpleague/commonmark)
# Installation
This project can be install via composer:
```
composer require n0sz/commonmark-picture-extension
```
# Usage
```php
use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
use N0sz\CommonMark\Picture\PictureExtension;

$environment = new Environment();
$environment->addExtension(new CommonMarkCoreExtension());
$environment->addExtension(new PictureExtension());
```
# Syntax
Code:
```txt
[[[
+ img_1 {media:"(min-width:650px)"}
+ img_2 {media:"(min-width:465px)"}
- img_3
]]]
```
Result:
```html
<picture>
<source media="(min-width:650px)" srcset="img_1" />
<source media="(min-width:465px)" srcset="img_2" />
<img src="img_3" />
</picture>
```

0 comments on commit c6761d4

Please sign in to comment.