h5o is an implementation of the HTML5 outline algorithm in JavaScript. Specifications:
If you like this tool, please consider a charitable donation to Ocean Voyages Institute (Project Kaisei).
npm install h5o
(as of 2015, you should not be using any other way of managing your JS dependencies, but
you can still download latest release)
- Use the UMD module available in
dist/outliner.min.js
with a fallback to globalHTML5Outline
orvar HTML5Outline = require('h5o')
in node or browserify var outline = HTML5Outline(startFrom)
(you likely wantstartFrom
to bedocument.body
). Returned value is an outline object, with sections.outline.asHTML( [ options | createLinks ])
to get HTML with an ordered list.- If
options.createLinks
(orcreateLinks
) istrue
, the DOM will be amended with IDs and the list will contain links for navigation. - If
options.skipToHeader
is true, the outline HTML will only include the sub-sections of the first section in the outline (which is usually thebody
), i.e. it will only contain the sections of the documents, skipping the title of the whole document.
- If
Visit https://h5o.github.io/ for the Chrome extension and bookmarklet.
- install
node
npm install -g grunt-cli
npm install
in your local clone of this repo
Run grunt test
- Will launch buster server and capture the system default browser with it
- Will run tests in node using
jsdom
- Will run tests in PhantomJS
Run grunt watch
- Will watch for file changes and rebuild/run tests automatically
- ???
- Fix for h5o/h5o-chrome #10 / #18
- Split off bookmarklet into a separate repo: https://github.com/h5o/h5o-bookmarklet
- Bookmarklet no longer part of GH releases
- Some styling for bookmarklet.html
- Auto-publish in npm via Travis
- Fixed #18: Add an option to skip the top-level header when generating a ToC (thanks @jyasskin)
- Split up
getHeadingElementRank
intogetRankingHeadingElement
andgetRank
Section
no longer hasasHTML
(out of scope)
Outline
is not a separate object of its owngetSectionHeadingRank
cleanup- Travis runs tests in both -
jsdom
v4.x and v3.x viajsdom-compat
- Throw when non-sectioning root / content element passed in for outlining
- Cleanup
- More tests
- Added jsdom@4.x on io.js to the test matrix
- Fixed implied headings to follow the spec - this actually means the previous implementation was
incorrect - updated the following tests:
navfirst
,issue-13
. Issue #13 was partly invalid. - Added more examples from the spec
- Updated to the latest specified algorithm
- Fixed #11: HTML entity escaping
- Fixed #13: problems with sectioning root elements inside the outline
- Properly handling of
hgroup
without anyh1
-h6
inside
- Renamed
grunt start-dev
in favor a simplergrunt watch
- Bookmarklet now goes via browserify
- Bookmarklet works in Firefox again (fixes #6)
- Fixed #9
- Travis deploy (second try)
- Travis deploy
- Run tests on node 0.12 and io.js
- Run tests in phantom.js as well as real browsers
- README updates
- ignore
.grunt
folder
- Using browserify instead of concatenation
- Made tests pass with
jsdom
- Updated browsers and dependencies
- Replaced intern with buster
- Using ejs to generate bookmarklet HTML
- Using gh-pages to publish the bookmarklet
- Using intern
- Using SauceLabs
- Using travis
- Rewritten build scripts with
grunt
- Split away Chrome extension, removed Opera/Firefox extension code
- First version published in npm
Originally lived on Google Code, if you like archeology