-
Notifications
You must be signed in to change notification settings - Fork 863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a 'meta' property to return values to give access to MMD's metadata #76
Conversation
…al rule as per markdown extra
header cells, and optional borders
… advanced_tables
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.
Hmmm I'm not sure about doing this in this exact fashion.
Thoughts? |
Might not have thought this through fully. I mainly tested this through goofing around in node... I stuck the Subject: Software not painful to use
Subject_short: painless software
Topic: /misc/coolsw
Archive: no
Date: Nov 20 2006
Order: -9.5
inMenu: true
### General ###
* *Operating System* : [Mac OS X][switch]: heaven, after the purgatory of Linux
and the hell of Windows. The top part is the metadata... Here's the script I ran with node to test : fs=require('fs');
md=require('./markdown.js');
fs.readFile('./misc_sw.text',function(err,str){
console.log(md.toHTML(str.toString(),'Maruku').meta.subject)}); I get as a response The thing that bothers me the most is that in the { firefox: { href: 'http://getfirefox.com/' },
gmail: { href: 'http://gmail.com/' },
bloglines: { href: 'http://bloglines.com/' },
wikipedia: { href: 'http://en.wikipedia.org/' }
/*etc */
} Haven't really looked enough at how that is used though. |
…wn-js Conflicts: lib/markdown.js
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.