baraja-core / markdown-latte-filter
Tools for content rendering.
Installs: 87 720
Dependents: 4
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 3
Requires
- php: ^8.0
- baraja-core/markdown: ^1.0
- baraja-core/url: ^1.1
- latte/latte: ^2.9
- league/commonmark: ^2.0
- nette/application: ^3.1
- nette/di: ^3.0
- nette/utils: ^3.2
Requires (Dev)
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.0
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-nette: ^1.0
- phpstan/phpstan-strict-rules: ^1.0
- roave/security-advisories: dev-master
- spaze/phpstan-disallowed-calls: ^2.0
- tracy/tracy: ^2.8
This package is auto-updated.
Last update: 2024-12-08 18:10:01 UTC
README
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 byhtmlspecialchars
function only).