{"id":16974571,"url":"https://github.com/lelinhtinh/jepub","last_synced_at":"2025-03-17T08:38:02.211Z","repository":{"id":32400089,"uuid":"132554473","full_name":"lelinhtinh/jEpub","owner":"lelinhtinh","description":"Simple EPUB builder library, works in modern browsers.","archived":false,"fork":false,"pushed_at":"2024-03-16T02:56:15.000Z","size":1195,"stargazers_count":46,"open_issues_count":4,"forks_count":19,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-27T21:48:29.806Z","etag":null,"topics":["browser","epub","epub-generation","generator","javascript","library"],"latest_commit_sha":null,"homepage":"https://lelinhtinh.github.io/jEpub/","language":"EJS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lelinhtinh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-08T04:38:46.000Z","updated_at":"2024-10-21T20:59:16.000Z","dependencies_parsed_at":"2023-02-17T22:16:25.633Z","dependency_job_id":"8a94fe1c-575e-48f9-bd4f-b5f35e269ec3","html_url":"https://github.com/lelinhtinh/jEpub","commit_stats":{"total_commits":156,"total_committers":7,"mean_commits":"22.285714285714285","dds":"0.28846153846153844","last_synced_commit":"bb6c16ae39d4af318c23336fb11a8163aed3b37f"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lelinhtinh%2FjEpub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lelinhtinh%2FjEpub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lelinhtinh%2FjEpub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lelinhtinh%2FjEpub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lelinhtinh","download_url":"https://codeload.github.com/lelinhtinh/jEpub/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243853618,"owners_count":20358451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser","epub","epub-generation","generator","javascript","library"],"created_at":"2024-10-14T01:07:02.967Z","updated_at":"2025-03-17T08:38:01.903Z","avatar_url":"https://github.com/lelinhtinh.png","language":"EJS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jEpub\n\n[![npm version](https://badge.fury.io/js/jepub.svg)](https://www.npmjs.com/package/jepub)\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Flelinhtinh%2FjEpub.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Flelinhtinh%2FjEpub?ref=badge_shield)\n\nSimple EPUB builder library, works in modern browsers.\n\n## Demo\n\n1. [/demo](https://lelinhtinh.github.io/jEpub/demo/)\n2. [jsfiddle.net/rhov44gg](https://jsfiddle.net/baivong/rhov44gg/embedded/result,resources,js,html/)\n\n## Installation\n\n```bash\nnpm install --save jepub\n```\n\nYou can also use it via a CDN:\n\n```html\n\u003cscript src=\"https://unpkg.com/jepub/dist/jepub.min.js\"\u003e\u003c/script\u003e\n```\n\nor:\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/jepub/dist/jepub.min.js\"\u003e\u003c/script\u003e\n```\n\n## Dependencies\n\njEpub requires [JSZip](https://github.com/Stuk/jszip) and [EJS](https://github.com/mde/ejs). Make sure these libraries are loaded before starting your code.\n\n```html\n\u003cscript src=\"jszip.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"ejs.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"jepub.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n    const jepub = new jEpub()\n    // jepub.init({\n    // do something\n\u003c/script\u003e\n```\n\n## Usage\n\n```typescript\nconst jepub = new jEpub()\njepub.init({\n    i18n: 'en', // Internationalization\n    title: 'Book title',\n    author: 'Book author',\n    publisher: 'Book publisher',\n    description: '\u003cb\u003eBook\u003c/b\u003e description', // optional\n    tags: [ 'epub', 'tag' ] // optional\n})\n```\n\n- **i18n** only include the language codes defined in [`i18n.json`](https://github.com/lelinhtinh/jEpub/blob/master/src/i18n.json)\n- **description**: HTML string.\n- **tags**: Array.\n\n### Set published date\n\n```typescript\njepub.date(date: object)\n```\n\n- **date**: Date Object.\n\n### Set identifier\n\n```typescript\njepub.uuid(id: string | number)\n```\n\n- **id**: Unique id.\n\n### Add cover\n\n```typescript\njepub.cover(data: object)\n```\n\n- **data**: A Blob or an ArrayBuffer object from XMLHttpRequest.\n\n### Add notes\n\n```typescript\njepub.notes(content: string)\n```\n\n- **content**: HTML string.\n\n### Add chapter `*`\n\n```typescript\njepub.add(title: string, content: string | array, index?:number)\n```\n\n- **title**: Plain text.\n- **content**:\n  - `string`: HTML string.\n  - `array`: Plain text for each item.\n- **index**: Item index.\n\n### Add image\n\n```typescript\njepub.image(data: object, IMG_ID: string)\n```\n\n- **data**: A Blob or an ArrayBuffer object from XMLHttpRequest.\n- **IMG_ID**: Unique id.\n\nPlace `\u003c%= image[IMG_ID] %\u003e` inside the chapter's content *(HTML string only)*, where you want to display it.\n\n### Generate EPUB `*`\n\n```typescript\njepub.generate(type = 'blob', onUpdate?: metadata =\u003e void)\n```\n\n- **type**: The type of EPUB to return. See [JSZip type option](https://stuk.github.io/jszip/documentation/api_jszip/generate_async.html#type-option).\n- **onUpdate**: _(optional)_ Callback function. See [JSZip onUpdate callback](https://stuk.github.io/jszip/documentation/api_jszip/generate_async.html#onupdate-callback).\n\n### Static methods `+`\n\n#### Convert HTML to text\n\n```typescript\njEpub.html2text(html: string, noBr = false)\n```\n\n- **html**: HTML string.\n- **noBr**: Boolean. Add line break after Block-level elements.\n\n## Development\n\n```bash\nnpm start\n```\n\nBuilds are concatenated and minified using [Webpack](https://webpack.js.org/) and [Babel](https://babeljs.io/).\n\n```bash\nnpm run build\n```\n\n## License\n\n[ISC](./LICENSE). Copyright 2018 [lelinhtinh](https://github.com/lelinhtinh)\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Flelinhtinh%2FjEpub.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Flelinhtinh%2FjEpub?ref=badge_large)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flelinhtinh%2Fjepub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flelinhtinh%2Fjepub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flelinhtinh%2Fjepub/lists"}