Skip to content

Instantly share code, notes, and snippets.

@vitorio
Forked from joseph/The Zhook format
Created July 19, 2010 09:12
Show Gist options
  • Save vitorio/481186 to your computer and use it in GitHub Desktop.
Save vitorio/481186 to your computer and use it in GitHub Desktop.
Zhook: Zip + HTML + Book.
DRAFT SPECIFICATION
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119.
Software that displays a Zhook file is here called a Reading System (RS).
A Zhook file is a zip file with a .zhook extension, which MUST contain:
* index.html
* cover.png
It may also contain stylesheets, images and other media as referenced in
the index.html file.
The index.html file SHOULD be HTML5 and MUST be correctly parsed by the
HTML5 parsing model. The entire text content of the book belongs in this
file. Where relevant and supported by the RS (eg, in an iframe), extra-
linear HTML components may be supplied in the package as separate files.
The RS MUST give the HTML element an id that is unique to the combination
of display, renderer and features in the RS, and MUST document it. The RS
MAY support whatever CSS properties it likes — a minimum of CSS Level 1
plus CSS3 media queries are RECOMMENDED. The RS and/or RS creator MUST
document what properties are un/supported. Book designers SHOULD provide
base CSS rules and MAY target specific reading systems with special CSS
rules where relevant, using the HTML ID or CSS3 media queries.
The RS MAY modify the DOM — for instance, to chunk the book into one or
more sections rendered at a time, rather than rendering the entire HTML
file at once. The RS creator MUST document these modifications so that book
designers can prepare their CSS accordingly.
Book metadata MAY be defined with HTML <META> elements, using the name and
content attributes. There is no required metadata. The RS creator MUST
document what meta tag names it supports.
The RS MAY disable script tags and event handlers. If so, the RS creator
MUST document this; if not, it MUST document what Javascript operations
are un/supported.
The RS creator SHOULD document what HTML microformats it supports for
interaction (such as footnotes, maps, table navigation, image zooming,
video, etc). The RS MAY use a documented microformat for the Table of
Contents, if it finds it in the index.html file. Otherwise, it should
derive the Table of Contents from HTML elements, using the algorithm
described here:
https://developer.mozilla.org/en/Sections_and_Outlines_of_an_HTML5_document
@joseph
Copy link

joseph commented Jul 20, 2010

I concede you're right that supporting HTML5 is plenty enough, seeing as pretty much any HTML4 or XHTML document can be made HTML5 by changing the doctype. And asserting HTML5 as a requirement lets us encourage better structural markup (like the use of <section> tags), and derive conventions from it.

I like the suggestion that the <html> element get the RS ID attribute rather than the <body>.

I decided to drop all reference to minimum CSS capabilities. In practice, all major HTML rendering engines have reasonable CSS2.0 and lower support, and emerging support for CSS3. If, somehow, an RS has weak CSS support, that's its own problem, and arguably a problem for the CSS specs. It's better not to clutter this spec with non-issues.

In all sincerity: thanks for the feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment