gettalong / kramdown

kramdown is a fast, pure Ruby Markdown superset converter, using a strict syntax definition and supporting several common extensions.
http://kramdown.gettalong.org
Other
1.72k stars 275 forks source link

fix: cast source to a string before checking encoding #807

Closed roelbondoc closed 4 months ago

roelbondoc commented 4 months ago

Because of this change in rails, the template source that gets passed into here could be an ActionView::OutputBuffer which doesn't respond to valid_encoding?. The quick fix here is to cast it into a string first.

gettalong commented 4 months ago

I'm sorry but the quick fix here is to follow the kramdown API documentation and provide a string to the method and not an object from some some other library:

https://github.com/gettalong/kramdown/blob/bd678ecb59f70778fdb3b08bdcd39e2ab7379b45/lib/kramdown/parser/base.rb#L89-L91