microformats / microformats.io

Simple explainer site about Microformats.

Home Page:https://microformats.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add /compare

veganstraightedge opened this issue · comments

That shows the results of each of the parsers for a given URL.

Inspired by @willnorris' mf2 compare site.

https://willnorris.github.io/mf2compare

commented

@Zegnat and I especially would like a version with a html-entry-box, not just a URL field. I'm not sure what would be the best way to implement it, but would try to help if I can. (I'd like to have this locally, but throwing all of it in a giant vagrant box afterwards should be doable. Being made for deployment on heroku at least keeps state away)

Since the parsers are running on subdomains (and different dynos I assume?), maybe adding an endpoint that returns pure JSON to each of them and fetch them from the browser would be a possible solution?

A good example of aggregating multiple parsers (IMHO) is MacFarlane’s Babelmark 2 for Markdown.

The way it communicates with different parsers is documented in its FAQ:

How can I add my markdown implementation to Babelmark 2?

Write a server app or CGI script that accepts accepts GET queries, takes the text out of the text parameter, and returns a javascript object with the following fields: name (the name of the markdown processor), version (the version being run), and html (the result of converting the text to HTML).

Example:

$ curl 'http://johnmacfarlane.net/cgi-bin/pandoc-dingus?text=hi'
{"name":"Pandoc","html":"<p>hi</p>","version":"1.9.4.2"}

The script can, if desired, return an error if the input text exceeds 1000 characters.

@sknebel @Zegnat I'm open to pull requests.

Come up with a protocol and I'll gladly update the Go parser.

Curious that Babelmark uses GET instead of POST... isn't the latter just as simple when doing XHR? Some other reason to use GET that I'm not thinking of?