evilstreak/markdown-js — pull request #76 by rtpg (2013-02-20 11:47:53+00:00)
Title: Add a 'meta' property to return values to give access to MMD's metadata

I've added a 'meta' property to all the return values to functions in the exposed properties. This collects information that is not used for the rendering of the markdown but might be useful to the user, such as Multimarkdown's metadata.

In MMD, metadata is represented in the source as several lines like the
following:

Author : some guy
Title : super title

These key-value pairs aren't used for the HTML rendering, so were not
represented in the return values of the exposed function. Now the k-v pairs
are given in a JSON object attached to the return string/tree.

The JSON object which stores these attributes also contain metadata on
references, which is used for the internal parsing. having "reference" as a
key in the metadata might break the parsing (not tested yet).

I also wrapped some of the return values in a String object, to allow for the
metadata to be attached (you can't attach attributes to primitives in
Javascript). The only side-effect that I could find is that it breaks classic
string equality testing (String('foo')!='foo'). there is a compare
function(localCompare) that can be used however.