https://github.com/baraja-core/markdown-latte-filter
Markdown filter to Latte
https://github.com/baraja-core/markdown-latte-filter
content escape latte latte-filter markdown-filter
Last synced: 6 months ago
JSON representation
Markdown filter to Latte
- Host: GitHub
- URL: https://github.com/baraja-core/markdown-latte-filter
- Owner: baraja-core
- License: mit
- Created: 2019-08-22T17:05:10.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-09-08T13:37:59.000Z (about 3 years ago)
- Last Synced: 2025-03-24T13:05:06.762Z (7 months ago)
- Topics: content, escape, latte, latte-filter, markdown-filter
- Language: PHP
- Homepage: https://baraja.cz
- Size: 65.4 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Markdown Latte filter
=====================Tools for automatic work with markdown.
How to install
--------------Simple call Composer command:
```shell
$ 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:
```yaml
extensions:
markdownLatteFilter: Baraja\Markdown\MarkdownLatteFilterExtension
```Latte filter
------------Basic use in Latte template:
```html
{$content|markdown}
```That will generated `
` automatically with the content:```html
Final content...
```To easily style content within a particular project, the `
` 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).