[kramdown-users] Performance optimizations

Thomas Leitner t_leitner at gmx.at
Thu Oct 28 08:04:05 EDT 2010

On 2010-10-28 16:45 +0700 Shawn Van Ittersum wrote:
> Hi Thomas,
> How do you implement preservation of element attribute order?  Would
> you please point me to it in the code?

Have a look at the file lib/kramdown/utils/ordered_hash.rb. The class
OrderedHash implements the needed methods to mimick a basic Hash class
that preserves the insertion order.

Note, however, that this is *not* needed under Ruby 1.9 since the
built-in Hash does automatically preserve the insertion order. One of
the performance improvements was to alias `OrderedHash = Hash` in case
of Ruby 1.9.

-- Thomas

More information about the kramdown-users mailing list