Comments (2)
I have tried it according to the documentation and it works like expected.
My steps:
composer require twig/markdown-extra
composer require twig/markdown-extra league/commonmark
Add the Twig extension in container.php for the Twig::class
definition:
use Twig\Extra\Markdown\DefaultMarkdown;
use Twig\Extra\Markdown\MarkdownExtension;
use Twig\Extra\Markdown\MarkdownRuntime;
use Twig\RuntimeLoader\RuntimeLoaderInterface;
// ...
Twig::class => function (ContainerInterface $container) {
// ...
$twig->addExtension(new MarkdownExtension());
// ...
$twig->addRuntimeLoader(new class implements RuntimeLoaderInterface {
public function load($class) {
if ($class === MarkdownRuntime::class) {
return new MarkdownRuntime(new DefaultMarkdown());
}
}
});
// ...
},
Create a Twig template:
{% apply markdown_to_html %}
# Header
Text
## Top 1
{% endapply %}
Render it as usual:
return $this->twig->render($response, 'filename.twig', $viewData);
Result:
from slim4-skeleton.
Hello @odan ,
Thanks for checking on this. I used your template and it worked here.
The issue was that I was using Markdown and Inky inside the same tags, and it was conflicting with each other.
This is the code I was using, and if you test there you wont get the H1
{% apply markdown_to_html|inline_css|inky_to_html %}
<style>
h1 {
color: #333;
}
</style>
<container>
<row class="header">
<columns>
# Hello World
</columns>
</row>
</container>
{% endapply %}
The solution I found after knowing it was working (thanks for that!!), is to separate the tags, like this:
{% apply inline_css|inky_to_html %}
<style>
h1 {
color: #333;
}
</style>
<container>
<row class="header">
<columns>
{% apply markdown_to_html %}
# Hello World
{% endapply %}
</columns>
</row>
</container>
{% endapply %}
I`m not sure if its the best solution, but it definitely works
Thanks again for your help!!
from slim4-skeleton.
Related Issues (20)
- Install troubleshooting HOT 2
- Wrong statement in the configuration doc page HOT 4
- Database migrations with phinx and schema.sql generation HOT 5
- Which session package should I use? HOT 4
- Missing TemplateRenderer/HtmlRenderer HOT 2
- Question: MVC vs ADR Pattern HOT 2
- Link in docs is wrong HOT 1
- logger test's settings are useless HOT 4
- How to use loggerFactory in Routing/JwtAuth
- Using skeleton in a subdirectory HOT 2
- Error add slim/twig-view (composer require slim/twig-view) HOT 2
- Cannot install csfr without using downgrade HOT 2
- Running phpstan on a clean installation gives warnings
- running phpunit on clean installations gives warnings
- 404 in /docs/configuration.md HOT 2
- How to handle query error ? HOT 5
- How to handle data from repository to presentation as JSON for REST API HOT 4
- Add demonstration URL HOT 5
- Letting the bin/console.php setup command have non-interactive mode HOT 5
- Any auth in your sceleton? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slim4-skeleton.