techdiary / commonmark-extensions
Laravel useful CommonMark extension for Laravel 5, 6 & 7
Requires
- php: ^7.1.3
- ext-json: *
- league/commonmark: ^1.1.0
- spatie/commonmark-highlighter: ^2.1
Requires (Dev)
- mockery/mockery: ^1.2
- phpunit/phpunit: ^7.0
README
A Laravel PHP Composer packaged of useful CommonMark extensions for The PHP Leagues CommonMark implementation.
Getting started
Instructions to install this extension to your Laravel project.
Prerequisites
- PHP >= 7.1
- Laravel >= 5.5 + or 6.0 +
Installation
Follow these steps to get this CommonMark extension working in your Laravel project!
Installing the Composer package
Run the following command at your root Laravel project directory (where package.json
exists).
$ composer require johnnyhuy/laravel-useful-commonmark-extension
Adding the Markdown extension to a config
Add JohnnyHuy\Laravel\UsefulCommonMarkExtension::class
in config/markdown.php
in the extensions
array. Here's an example:
'extensions' => [ ... JohnnyHuy\Laravel\UsefulCommonMarkExtension::class ... ],
Running the tests
Clone this repository and run composer install
to install all relevant Composer packages. Change the root extension directory and run the following command to execute PHPUnit test cases.
$ vendor/bin/phpunit tests/
Wiki
I've composed a wiki page to describe features of this extension.
Markdown features
Gist
:gist https://gist.github.com/noxify/2b02fd0fb0ea18a4d9d764e31fe9af8e
Codepen
:codepen https://codepen.io/YusukeNakaya/pen/XyOaBj
SoundCloud
:soundcloud https://soundcloud.com/djtechnoboy/tnt-sound-rush-right-now
YouTube
:youtube https://www.youtube.com/watch?v=pwmY1XUTBpE
Color
# Worded colors :color red Hello I should be in red text :D :color :color-red this is inline! :color # 3 Character hex :color #AAA Hello! :color :color-#AAA this is inline! :color # 6 Character hex :color #DADADA Hello! :color :color-#DADADA this is inline! :color # RGB :color 255,255,255 Hello! :color :color-255,255,255 this is inline! :color # RGBA :color 255,255,255,50 Hello! :color :color-255,255,255,50 this is inline! :color
Text Alignment
# Center alignment :text-center Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean tincidunt urna maximus sem congue, viverra ultrices purus porta. Aenean at porta mi. Donec ut felis consectetur, rutrum mauris non, sagittis ipsum. Quisque sit amet fringilla lorem. Curabitur euismod imperdiet nunc, et vehicula lorem scelerisque et. Fusce rutrum id lectus in pellentesque. Donec vel cursus dolor. Ut placerat justo nunc, a imperdiet libero posuere non. Nullam dolor ligula, efficitur a accumsan non, viverra quis lorem. Mauris at auctor ligula. :text-center # Right alignment :text-right Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean tincidunt urna maximus sem congue, viverra ultrices purus porta. Aenean at porta mi. Donec ut felis consectetur, rutrum mauris non, sagittis ipsum. Quisque sit amet fringilla lorem. Curabitur euismod imperdiet nunc, et vehicula lorem scelerisque et. Fusce rutrum id lectus in pellentesque. Donec vel cursus dolor. Ut placerat justo nunc, a imperdiet libero posuere non. Nullam dolor ligula, efficitur a accumsan non, viverra quis lorem. Mauris at auctor ligula. :text-right # Left alignment :text-left Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean tincidunt urna maximus sem congue, viverra ultrices purus porta. Aenean at porta mi. Donec ut felis consectetur, rutrum mauris non, sagittis ipsum. Quisque sit amet fringilla lorem. Curabitur euismod imperdiet nunc, et vehicula lorem scelerisque et. Fusce rutrum id lectus in pellentesque. Donec vel cursus dolor. Ut placerat justo nunc, a imperdiet libero posuere non. Nullam dolor ligula, efficitur a accumsan non, viverra quis lorem. Mauris at auctor ligula. :text-left
Contribution
- Project derived from Graham Campbell's emoji parser for Laravel
- Johnny Huynh - Initial changes
License
This project is licensed under the MIT license, see LICENSE for more information.
- league/commonmark is licensed under the BSD-3 license
- GrahamCampbell/Laravel-Markdown is licensed under the MIT License
- AltThree/Emoji is licensed under the MIT License