microformats2 - Microformats Wiki
microformats2
From Microformats Wiki
(Redirected from
microformats-2
Jump to navigation
Jump to search
Contents
Summary
1.1
simple microformats2 examples
1.1.1
person example
1.1.2
hyperlinked person
1.1.3
hyperlinked person image
1.1.4
detailed person example
1.2
details from examples
1.3
microformats2 design
v2 vocabularies
2.1
h-adr
2.2
h-card
2.3
h-entry
2.4
h-event
2.5
h-geo
2.6
h-item
2.7
h-product
2.8
h-recipe
2.9
h-resume
2.10
h-review
2.11
h-review-aggregate
2.12
v2 vocab notes
2.13
v2 vocab to-do
combining microformats
3.1
h-event location h-card
3.2
h-card org h-card
authoring
4.1
minimal markup
4.2
backward compatible
extensions
5.1
experimental extensions
5.2
vendor extensions
5.3
extensions background
validators
Examples in the wild
7.1
offline
Implementations
8.1
Live Textarea Input
8.2
Blogging tools
8.3
Converters
8.4
Parsers
8.4.1
Parsers in production
8.4.2
Development parsers
8.4.3
Experiments
8.5
Outreach
Presentations
10
Testimonials
11
Origins
12
See Also
Welcome to the microformats2 home page.
Summary
Microformats2 is the latest version of microformats, the simplest way to markup structured information in HTML. Microformats2 improves ease of use and implementation for
both
authors (publishers) and developers (
parser
implementers).
Developers: see the
microformats2-parsing
specification
Microformats2 replaces and supersedes both classic microformats (sometimes called microformats1), as well as incorporates lessons learned from
microdata
and
RDFa
simple microformats2 examples
Here are a few
simple microformats2 examples
along with canonical
JSON
person example
Simple person reference:
span
class
"h-card"
Frances Berriman
span
Parsed JSON:
"items"
[{
"type"
"h-card"
],
"properties"
"name"
"Frances Berriman"
}]
hyperlinked person
Simple hyperlinked person reference
class
"h-card"
href
"http://benward.me"
Ben Ward
Parsed JSON:
"items"
[{
"type"
"h-card"
],
"properties"
"name"
"Ben Ward"
],
"url"
"http://benward.me"
}]
hyperlinked person image
Simple hyperlinked person image
class
"h-card"
href
"http://rohit.khare.org/"
img
alt
"Rohit Khare"
src
"https://s3.amazonaws.com/twitter_production/profile_images/53307499/180px-Rohit-sq_bigger.jpg"
/>
Parsed JSON:
"items"
[{
"type"
"h-card"
],
"properties"
"name"
"Rohit Khare"
],
"url"
"http://rohit.khare.org/"
],
"photo"
"https://s3.amazonaws.com/twitter_production/profile_images/53307499/180px-Rohit-sq_bigger.jpg"
}]
Additional simple cases details in
microformats-2-implied-properties
detailed person example
More detailed person
div
class
"h-card"
img
class
"u-photo"
alt
"photo of Mitchell"
src
"https://webfwd.org/content/about-experts/300.mitchellbaker/mentor_mbaker.jpg"
/>
class
"p-name u-url"
href
"http://blog.lizardwrangler.com/"
Mitchell Baker
class
"u-url"
href
"https://twitter.com/MitchellBaker"
@MitchellBaker
span
class
"p-org"
Mozilla Foundation
span
class
"p-note"
Mitchell is responsible for setting the direction and scope of the Mozilla Foundation and its activities.
span
class
"p-category"
Strategy
span
span
class
"p-category"
Leadership
span
div
Parsed JSON:
"items"
[{
"type"
"h-card"
],
"properties"
"photo"
"https://webfwd.org/content/about-experts/300.mitchellbaker/mentor_mbaker.jpg"
],
"name"
"Mitchell Baker"
],
"url"
"http://blog.lizardwrangler.com/"
"https://twitter.com/MitchellBaker"
],
"org"
"Mozilla Foundation"
],
"note"
"Mitchell is responsible for setting the direction and scope of the Mozilla Foundation and its activities."
],
"category"
"Strategy"
"Leadership"
}]
details from examples
Details demonstrated by the examples:
The JSON
"type"
uses the full microformat root class name (e.g.
"h-card"
) for consistent identification.
all properties are optional and syntactically plural with parsed values provided in document order; particular microformats (and applications there-of) may apply specific/singular semantics to first value of a property.
microformats2 design
microformats2 has the following key design aspects:
Prefixes for class names
All microformats class names use prefixes. Prefixes are
syntax independent from vocabularies
, which are developed separately.
h-*
for root class names (e.g.
h-card
p-*
for plain text properties (e.g.
p-name
u-*
for URL properties (e.g.
u-photo
dt-*
for date/time properties (e.g.
dt-bday
e-*
for embedded markup properties (e.g.
e-note
See
microformats2-prefixes
for more details.
Flat sets of optional properties
All microformats consist of a root, and a collection of properties. Hierarchical data is represented with nested microformats, typically as property values themselves. Properties are all optional and potentially multivalued (applications needing a singular semantic may use first instance).
Single class markup for common uses
Common simple markup patterns require only a single microformat root class name, which parsers use to find a few generic properties:
name
url
photo
. The simple microformats2 examples above demonstrate these.
Parsing each prefix (including generating canonical JSON) is detailed step-by-step in:
The
microformats2 parsing specification
Note:
Most properties are specified and used with a single specific prefix (or occasionally two or three) that is self-evident from context. However, any parsing prefix can be used with any property, especially if you find a good reason to do so!
v2 vocabularies
Status:
draft
. Please review and provide feedback in
IRC
h-adr
h-card
h-entry
h-event
h-feed
h-geo
h-item
h-listing
h-product
h-recipe
h-resume
h-review
h-review-aggregate
See below for vocabulary summaries.
h-adr
Main article:
h-adr
The
h-adr
microformat is for marking up structured locations such as addresses, physical and/or postal. This is an update to
adr
root class name:
h-adr
profile/itemtype: http://microformats.org/profile/h-adr
properties:
p-post-office-box
p-extended-address
p-street-address
p-locality
p-region
p-postal-code
p-country-name
p-label
- new in
vCard4
RFC6350
p-geo
(or
u-geo
with a RFC 5870 geo: URL) - new in
vCard4
RFC6350
p-latitude
- new in
vCard4
RFC6350
from RFC 5870)
p-longitude
- new in
vCard4
RFC6350
from RFC 5870)
p-altitude
- new in
vCard4
RFC6350
from RFC 5870)
For backward compatibility, microformats2 parsers
SHOULD
detect the following root class name and property names. A microformats2 parser may use existing classic microformats
parsers
to extract these properties. If an "h-adr" is found, don't look for an "adr" on the same element.
compat root class name:
adr
properties: (parsed as
p-
plain text unless otherwise specified)
post-office-box
extended-address
street-address
locality
region
postal-code
country-name
h-card
Main article:
h-card
The
h-card
microformat is for marking up people and organizations. This is an update to
hCard
root class name:
h-card
profile/itemtype: http://microformats.org/profile/h-card
properties:
p-name
p-honorific-prefix
p-given-name
p-additional-name
p-family-name
p-sort-string
p-honorific-suffix
p-nickname
u-email
u-logo
u-photo
u-url
u-uid
p-category
p-adr
p-post-office-box
p-extended-address
p-street-address
p-locality
p-region
p-postal-code
p-country-name
p-label
p-geo
or
u-geo
with a RFC 5870 geo: URL, new in
vCard4
RFC6350
p-latitude
p-longitude
p-altitude
- new in
vCard4
RFC6350
from RFC 5870)
p-tel
p-note
dt-bday
u-key
p-org
p-job-title
- previously 'title' in hCard, disambiguated.
p-role
u-impp
per RFC 4770, new in
vCard4
RFC6350
p-sex
new in
vCard4
RFC6350
p-gender-identity
new in
vCard4
RFC6350
dt-anniversary
new in
vCard4
RFC6350
...
Reserved properties: (properties not used much (if at all) in practice)
p-organization-name
p-organization-unit
p-tz
dt-rev
...
For backward compatibility, microformats2 parsers
SHOULD
detect the following root class name and property names. A microformats2 parser may use existing classic microformats
parsers
to extract these properties. If an "h-card" is found, don't look for a "vcard" on the same element.
compat root class name:
vcard
properties: (parsed as
p-
plain text unless otherwise specified)
fn
- parse as
p-name
honorific-prefix
given-name
additional-name
family-name
honorific-suffix
nickname
email
- parse as
u-
logo
- parse as
u-
photo
- parse as
u-
url
- parse as
u-
uid
- parse as
u-
category
adr
- parse as
p-adr h-adr
including compat root class
adr
extended-address
street-address
locality
region
postal-code
country-name
label
geo
- parse as
p-geo h-geo
including compat root class
geo
latitude
longitude
tel
note
bday
- parse as
dt-
key
- parse as
u-
org
organization-name
organization-unit
title
- parse as
p-job-title
role
...
Reserved: (backward compat properties that parsers
MAY
implement, if they do, they
MUST
implement in this way:
tz
rev
- parse as
dt-
...
Note: use of 'value' within 'tel' should be automatically handled by the support of the
value-class-pattern
. And for now, the 'type' subproperty of 'tel' is dropped/ignored. If there is demonstrable documented need for additional tel types (e.g. fax), we can introduce new flat properties as needed (e.g. p-tel-fax).
h-entry
Main article:
h-entry
The
h-entry
microformat is for marking up syndicatable content such as blog posts, notes, articles, comments, photos and similar. This is an update to
hAtom
root class name:
h-entry
profile/itemtype: http://microformats.org/profile/h-entry
properties:
p-name
(was p-entry-title, see issues)
p-summary
(was p-entry-summary, see issues)
e-content
(was e-entry-content, see issues)
dt-published
dt-updated
p-author
p-category
u-url
u-uid
p-geo
p-latitude
p-longitude
This is an update to
hAtom
Brainstorming:
The following properties are proposed additions to h-entry above and beyond what hAtom (or Atom) provides, based on various existing link preview markup conventions:
u-photo
u-audio
- consider special u- parsing rules for