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 274 forks source link

Return empty string if argument is an empty hash #665

Closed ashmaroli closed 4 years ago

ashmaroli commented 4 years ago

When attr == {}, then end result to Kramdown::Utils::Html#html_attributes(attr) is always "", but involves allocation of intermediate empty array and the returned new empty string.

These allocations can be eliminated by returning a single frozen string every time attr is an empty hash.

gettalong commented 4 years ago

Thanks!