frctl / twig

Use Twig templates with Fractal.
32 stars 34 forks source link

Please consider adding the Markdown extension to the Twig adapter by default #11

Closed adrienne closed 5 years ago

adrienne commented 6 years ago

It's well-supported and it would be very helpful! https://github.com/ianbytchek/twig-js-markdown It uses the marked parser, which is already included by Fractal, so it should be pretty trivial.

Chapabu commented 6 years ago

I'm not sure I like the idea of this. I think we'd be better off documenting how to extend the adapter, and keeping a slim core that is closer to the native Twig implementation.

It shouldn't be too hard to integrate the above with individual Fractal instances, we just need to document it.

adrienne commented 6 years ago

@Chapabu - Okay, whatever works, but I can't figure out how to get it extended and I would definitely like to!

mihkeleidast commented 5 years ago

Created a PR to add this to docs, but I'll post this here in case anybody needs it:

const twigAdapter = require('@frctl/twig')();
const twigMarkdown = require('twig-markdown');
const instance = fractal.components.engine(twigAdapter);

// instance.twig refers to the twig.js instance
instance.twig.extend(twigMarkdown);