Brand new microformats 2 parser

I have just released a brand new microformats 2 parser for node.js. You maybe thinking microformats are so 2006, but this is new. Hear me out…

Demo API /> http://microformat2-node.jit.su/

Try the API with: /> http://the-pastry-box-project.net/ /> http://microformats.org/

New life in the semantic web

A lot has changed in the last couple of years; the search engines have started to use semantic mark-up to improve their listings. Google’s rich snippets feature has created a secret army of SEO people who are quietly marking up big parts of the web with semantic data. Not that there are not already billions of microformats on the web.

HTML5 created a third standard of semantic web mark-up to add to the mix of RDFa and microformats. Then the search engines clubbed together and brought us schema.org. After a few catfights between the standards supporter clubs, these events have brought us a small rebirth of the semantic web.

microformats 2

The microformats community has revisited it’s standard and come up with “microformats version 2”. At first, I thought why! I don’t like change unless it gives me something worthwhile. After reviewing the work, I think the wholesale change to a new version of microformats is worthwhile because:

  1. The authoring patterns have been simplified even more and they are based on real life use cases e.g.: Glenn Jones is a valid microformat
  2. />

  3. microformats 2 addresses one of the biggest problems in maintaining microformats in real sites. The class names are now prefixed i.e. class=”fn” is now class=”p-name”. The prefixes like “h-*” and “p-*” tells you a class is a microformat property and helps make sure classes are not moved or deleted by mistake
  4. />

  5. Like microdata, microformats 2 now has a full specification for a JSON API. This is important as it means the parsers should now have the same output and also browsers could implement this API.

New parser and test suite

Most importantly for me I wanted to help move forward microformats, I liked the fact that the API design aligned microformats 2 a little closer to microdata and RDFa. So I have invested a couple of months of my time to building a brand new JavaScript parsing engine and a comprehensive test suite.

microformat-node GitHub https://github.com/glennjones/microformat-node /> Test Suite GitHub https://github.com/microformats/tests

I have just open sourced a new version of microformat-node using this parsing engine. Soon I will create a browser compatible version of the engine and update the microformat-shiv library which powers browser plug-ins etc.

The test suite took a long time to develop, but should provide an excellent starting point for anyone else who wants to develop a new microformats 2 parser. I know Barnaby Walters has already started working with it for his php-mf2 parser.

I hope this work will help microformats and the concept of the semantic web move forward another little step. Enjoy

Mentions:

Ho nice! We’ve been *wanting* to add support for hAtom for years now… but this may be the right trigger!

Excellent Glenn!

So, who is actually using microformats version 2? If nobody then what is the point of converting my website to something that will break what is current there (microformats version 1)?

Instead, why not wait for HTML 5 to be ratified, and then convert to Microdata. Microdata is supported by W3C, and so will win in the marketplace. Microformats are a dead end.

Regards, /> Bogus

To Bogus Name

The semantic web is a bit of a mess at the moment, three standards to do one thing. For the record W3C are actually supporting the development of both Microdata and RDFa. Microformats are still hugely popular, with 70% of all structure data domains in 2012 according to the Web Data Commons.

With any new format, adoption is always a chicken and egg situation. I think that microformats 2 has some very good qualities which are worth supporting and encouraging. As a developer I can do that by providing the tools for people to take something conceptual and use it for real.

The web community has not done a very good job of joined up effort with the semantic web. What is heartening is to see how all three standards are starting to converge a little, through the efforts of people like Manu Sporny and others.

I would not wait W3C to sort out which standard will win out, it will not happen. The three standards will continue to develop, pulling from each other.

In the end I am never get to tie to individual standards just to the ideas and concepts that drive them. Building this parser is a much about seeing if ideas behind microformats 2 supply the best mix of ‘easy of authoring’ and flexibility in what date can be described. Something all three standards have tried to balance in the past, but just misses the mark.

So no it brand new standard no one is using it just yet, a bit like HTML5 was then that first started and no and microformats are not dead end.

Regards, /> Glenn

Thanks for the good work. I have been think of creating a new microformat to representing tourist attractions. How can i create a parser to process the new microformat?

Glenn, this is AWESOME!

I’ve tried a whole bunch of pages with microformats2 with your parser and it works really well.

A few clarifications from “Bogus”‘s post: /> * You can use both microformats2 and microformats1 simultaneously no problem. /> * It’s going to be years before “HTML 5 [is] to be ratified” – but that’s no reason to not to use it. /> * As Glenn points out, W3C has many ways of marking things up: microdata, RDFa, microformats are all listed on w3.org/html5 in the “Class: Semantics” section. W3C also uses microformats on their events pages, and in numerous specifications to markup the authors/editors and other information. /> * There’s a lot of microformats2 use in the wild – the spec links to a few of them.

But what’s particularly great is that Glenn’s microformats2 parser fully supports the well-adopted “original” microformats, so e.g. to Julien Genestoux’s point, clients and sites can use the parser to consume hAtom, which is incredibly well deployed across the web (every WordPress blog and more).

Once again, thanks again for your awesome work Glenn, on both the microformats2 parser and the test suite.

-Tantek

In full agreement with Tantek, this is awesome.

Mentioned this post?