contentful_rails icon indicating copy to clipboard operation
contentful_rails copied to clipboard

Subclassing MarkdownRenderer

Open dezmathio opened this issue 8 years ago • 5 comments

so, I was following your README on subclassing the markdown renderer, and I realized that in your markdown_helper.rb parse_markdown method you always instantiate the renderer = ContentfulRails::MarkdownRenderer.new(renderer_opts) So, how do you typically force your engine to use your new and improved subclassed markdown renderer?

dezmathio avatar Oct 25 '16 18:10 dezmathio

@dezmathio we have re-defined parse_markdown in a new helper in the project to to this.

edtjones avatar Oct 25 '16 18:10 edtjones

I see, we thought of doing that as well. Do you think that it would be worthwhile making a configuration attribute such as .markdown_renderer where we could override it if we were using a subclassed one, else it would always use the default one? That way we could cut down on code duplication & have a somewhat cleaner solution. Thoughts? cc @pmoore

dezmathio avatar Oct 25 '16 18:10 dezmathio

I'll leave @dlitvakb to decide, @dezmathio - he maintains now.

edtjones avatar Oct 25 '16 19:10 edtjones

Hey @dezmathio,

Looks like something we can improve on,

I'll look onto it as soon as I have a free slot on my schedule.

I'll propose taking a look again to refining this gem during next week's planning.

I'll try to get you an update by this time next week.

Cheers

dlitvakb avatar Oct 25 '16 20:10 dlitvakb

Hey @dezmathio,

Sorry response took a bit longer, I've been travelling quite a bit (right now at RubyConf US).

My first priority now is to address all Rails Integration related issues, including this one, so I'll be tackling this issue in the next few days and have a PR ready for merge as soon as possible.

Cheers

dlitvakb avatar Nov 10 '16 20:11 dlitvakb