icon wikibook Chrome extension

This is a chrome extension for creating a single html file from a hierarchy of wiki pages.

To use it you obviously first need to install it by dragging the crx file onto the chrome browser. You will be asked for permission and told that it has requested permission to access your tabs and all websites. It is designed to work on any MediaWiki wiki or Redmine wiki, and makes use of the MediaWiki "?action=render" command to extract just the content of each page. For Redmine, the content is extracted from the regular wiki page. A variety of rules of thumb are used to manage headings and anchors, and to ensure that sections are properly nested.

You then need to go to the root page of the wiki for your report, logging in as required. Right click on the wiki page and then click "Save as Wiki Book". The page will clear and gradually fill with the content of the wiki pages linked from this wiki page. When it is done (it can take a while), an alert box will appear, and you should see a download on the download bar at the bottom of the browser. You can open the enclosing folder (~/Downloads on Linux) and move then rename the file as appropriate, e.g. "myreport.html". The file expects a style sheet called "report.css" in the same directory.

Don't try to use the "save as" menu item in the browser as that saves the original wiki page, which isn't what you want!

The report subsections are given with h2, h3, h4 and so forth. The level is taken from the top level table of contents if present, otherwise from the indirection from the starting wiki page. The level of the headings in subsections will be adjusted to match the level of the subsection.You are encouraged to create a table of contents with bullet point lists, where the indentation denotes the level of the linked page. Don't leave blank lines in the list as that screws up the CSS numbering.

Here is a sample style sheet that adds numbering to the table of contents and the headings. You can then export to PDF via print to PDF if your browser supports it, or with tools like PrinceXML.

If your pages have links to other wiki pages that you don't want to include in your 'book', you should wrap them with a span element with class="no-follow", e.g. to avoid following the navigation link to My Home Page:

<span class="no-follow">[[My Home Page]]<span>

Links to wiki pages will by default be pushed to the end of the current set of queued pages. Sometimes this isn't what you want. To push the linked wiki page to immediately after this one, you should wrap them with a span element with class="insert-next", e.g.:

<span class="insert-next">[[Next Page]]<span>

Note that if you are using a standalone tool to render to PDF such as PrinceXML, then you may run into problems with images unless you have made local copies and patched the image links to match. Servers will often redirect users to login pages when the requester isn't already logged in. This is a general problem for HTTP clients and something I hope to address with further work on using the HTML5 File Writer API to make local copies of images automatically.

Your bug reports and suggestions are welcomed.


photoDave Raggett <dsr@w3.org> Copright (c) 2012-2013.

n.b. This software is free for any use at your own risk and can be freely re-distributed.