Componette

Componette

baraja-core

baraja-core / markdown-latte-filter v1.1.6

Markdown filter to Latte

download-cloud-line composer require baraja-core/markdown-latte-filter

Markdown Latte filter

Tools for automatic work with markdown.

How to install

Simple call Composer command:

$ composer require baraja-core/markdown-latte-filter

In project common.neon you must define Latte extension and services.

Fully works example configuration is in common.neon file in this package:

extensions:
    markdownLatteFilter: Baraja\Markdown\MarkdownLatteFilterExtension

Latte filter

Basic use in Latte template:

{$content|markdown}

That will generated <div> automatically with the content:

<div class="markdown">
   Final content...
</div>

To easily style content within a particular project, the <div> is automatically marked as a markdown class.

Filter |noescape is not required, escaping and security is started automatically by inner logic.

Renderer as a service

In case of using Markdown renderer in an inner model or an application logic, you should inject the service by DIC.

Default renderer is CommonMarkRenderer (package league/commonmark).

To override renderer please change definition of markdown.renderer service in project common.neon, or use some of these:

  • NoRenderer (return unchanged input),
  • SimpleRenderer (escape by htmlspecialchars function only).
bar-chart-fill

Statistics

download-cloud-fill
12661
star-fill
3
bug-fill
2
flashlight-fill
6d
price-tag-2-line

Badges

Componette Componette felix@nette.org