npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

epub-maker

v1.2.0

Published

Easily create downloadable epub files with javascript

Downloads

15

Readme

MIT License Build Status Code Climate Codacy Badge

js-epub-maker

js-epub-maker allows you to create and download epubs. It offers an API through which you can set meta info, navigation and content. js-epub-maker works by gutting IDPF's sample epub and refitting it with your content. The source epub this project is working with is The Waste Land (source code).

DEMO

API: Sections

There is some API to set all the meta-data, but the magic is in the way you can add sections. With sections you can add either all content with just one section, or finetune all the content so that it snugly fits the epub spec (with the various epub types described in the spec) and more importantly allows you to indicate exactly what should be included in the TOC and Landmarks section of the epub. You don't need to take care of all that, js-epub-maker will do that for you.

/**
 * @epubType Optional. Allows you to add specific epub type content such as [epub:type="titlepage"]
 * @id Optional, but required if section should be included in toc and / or landmarks
 * @content Optional. Should not be empty if there will be no subsections added to this section. Format: { title, content }
 */
EpubMaker.Section = function(epubType, id, content, includeInToc, includeInLandmarks) {
    ...
}

API example

Taken from the included test page, which is reproduced in the online demo.

new EpubMaker()
    .withUuid('github.com/bbottema/js-epub-maker::it-came-from::example-using-idpf-wasteland')
    .withTemplate('idpf-wasteland')
    .withAuthor('T. Est')
    .withLanguage('en-GB')
    .withModificationDate(new Date(2015, 8, 7))
    .withRights({
    	description: 'This work is shared with the public using the Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license.',
    	license: 'http://creativecommons.org/licenses/by-sa/3.0/'
    })
    .withAttributionUrl('https://github.com/bbottema/js-epub-maker')
    .withStylesheetUrl('src/test/content-for-epub/extra_styles.css')
    .withCover('src/test/content-for-epub/js-epub-maker-cover.jpg', {
    	license: 'http://creativecommons.org/licenses/by-sa/3.0/',
    	attributionUrl: 'http://www.webestools.com/web20-title-generator-logo-title-maker-online-web20-effect-reflect-free-photoshop.html'
    })
    .withTitle('It Came From... [Example Using Waste Land Template]')
    .withSection(new EpubMaker.Section('frontmatter', 'frontmatter', { title: 'Title page' }, false, true)
        .withSubSection(new EpubMaker.Section('titlepage', 'manuscript-header', header, false, false))
    )
    .withSection(new EpubMaker.Section('bodymatter', 'bodymatter', { title: 'Start of the story' }, false, true)
        .withSubSection(new EpubMaker.Section('preface', 'preface', preface, true, false))
        .withSubSection(new EpubMaker.Section('part', 'part-1', { title: 'Part 1' }, true, false)
            .withSubSection(new EpubMaker.Section('chapter', 'chapter-1', ch1, true, false))
            .withSubSection(new EpubMaker.Section('chapter', 'chapter-2', ch2, true, false))
        )
        .withSubSection(new EpubMaker.Section('part', 'part-2', { title: 'Part 2' }, true, false)
            .withSubSection(new EpubMaker.Section('chapter', 'chapter-3', ch3, true, false))
            .withSubSection(new EpubMaker.Section('chapter', 'chapter-4', ch4, true, false))
        )
    )
    .withSection(new EpubMaker.Section('backmatter', 'backmatter', { title: 'Notes and rest' }, false, true)
        .withSubSection(new EpubMaker.Section('rearnotes', 'rear-notes', { title: 'Notes on "It Came From"' }, true, false)
            .withSubSection(new EpubMaker.Section('rearnote', 'rearnote-1', rn1, false, false))
            .withSubSection(new EpubMaker.Section('rearnote', 'rearnote-2', rn2, false, false))
        )
    )
    .downloadEpub();