nedkelly / twing-markdown

Twing Extension for rendering Markdown in Twig templates
BSD 2-Clause "Simplified" License
4 stars 0 forks source link

No way to configure marked or change markdown engine #2

Open lionel87 opened 5 years ago

lionel87 commented 5 years ago

Hey! This plugin looks nice, but I have a question!

Do you plan adding support for custom markdown engines, or atleast provide a way to configure the current engine?

There is a similar markdown extension for TwigPHP which already supports what I was looking for: https://github.com/aptoma/twig-markdown

The same could be achieved here:

const engine = new MyMarkdownEngine(myOptions);
twing.addExtension(new TwingExtensionMarkdown(engine));

Or atleast adding a way to pass options to the marked parser:

const markedOptions = {
  "baseUrl": "http://example.com/",
  "breaks": true
};
twing.addExtension(new TwingExtensionMarkdown(markedOptions));

Thanks!

nedkelly commented 5 years ago

@lionel87 Thanks for the feedback, very much appreciated.

This is definitely something I'd like to add, I was in a rush to get this plugin up and running because it was blocking my ability to migrate from Twig.js to Twing, as a result there are some loose ends needing some love.

As soon as time permits I'll get back to it and add support for Browser and custom markdown engines.

Cheers