techdiary/commonmark-extensions

Laravel useful CommonMark extension for Laravel 5, 6 & 7

v2.1.4 2020-07-12 06:49 UTC

README

Build Status Latest Stable Version Total Downloads composer.lock available

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

More info

YouTube

:youtube https://www.youtube.com/watch?v=pwmY1XUTBpE

More info

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

More info

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

More info

Contribution

License

This project is licensed under the MIT license, see LICENSE for more information.