2017 © Pedro Peláez
 

symfony-bundle commonmark-bundle

Integrates CommonMark into Symfony 4 apps.

image

avensome/commonmark-bundle

Integrates CommonMark into Symfony 4 apps.

  • Saturday, May 5, 2018
  • by gronostajo
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Avensome CommonMark Bundle

Provides seamless integration of CommonMark with Symfony and Twig., (*1)

Requires PHP 7.0+ and Symfony 4.0+., (*2)

Installation

Install with Composer:, (*3)

composer require avensome/commonmark-bundle

Then add Avensome\CommonMarkBundle\AvensomeCommonMarkBundle to config/bundles.php:, (*4)

<?php

return [
    // ...
    Avensome\CommonMarkBundle\AvensomeCommonMarkBundle::class => ['all' => true],
];

Usage in services

CommonMarkConverter is an injectable service:, (*5)

<?php
use League\CommonMark\CommonMarkConverter;

class MyService
{
    public function __construct(CommonMarkConverter $converter)
    {
        // Do something with $converter
        // https://github.com/thephpleague/commonmark#basic-usage
    }
}

Usage in Twig

The markdown filter and tag are available in Twig., (*6)

{{ '# This string will be turned into HTML' | markdown }}

{% markdown %}
Contents of *these tags* will become HTML!

- Nunquam locus lanista.
- Neuter, barbatus solems aegre prensionem de secundus, salvus galatae.
- Rumor moris, tanquam castus verpa.
{% endmarkdown %}

Configuration

The CommonMarkConverter accepts configuration as one of its parameters. With this package you can adjust these in your Symfony configuration (config.yaml or similar). Just add the avensome_commonmark key, everything under it will be passed directly to the Converter., (*7)

# ...

avensome_commonmark:
    html_input: allow
    allow_unsafe_links: true

Extensions

To enable a CommonMark extension, just register it as a service and tag it with avensome_commonmark.extension., (*8)

For example to enable WebUni Table Extension, install it and edit your services.yaml:, (*9)

services:
    # ...

    Webuni\CommonMark\TableExtension\TableExtension:
        tags:
            - name: avensome_commonmark.extension

The Versions

05/05 2018

dev-master

9999999-dev

Integrates CommonMark into Symfony 4 apps.

  Sources   Download

MIT

The Requires

 

by Krzysztof Śmiałek

05/05 2018

0.1.1

0.1.1.0

Integrates CommonMark into Symfony 4 apps.

  Sources   Download

MIT

The Requires

 

by Krzysztof Śmiałek

04/05 2018

0.1.0

0.1.0.0

Integrates CommonMark into Symfony 4 apps.

  Sources   Download

MIT

The Requires

 

by Krzysztof Śmiałek