{"id":15405254,"url":"https://github.com/fnando/epub","last_synced_at":"2026-03-12T04:31:38.009Z","repository":{"id":219217290,"uuid":"748424009","full_name":"fnando/epub","owner":"fnando","description":"Create epub files using Ruby (EPUB 3.3).","archived":false,"fork":false,"pushed_at":"2025-12-12T19:07:44.000Z","size":123,"stargazers_count":5,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-18T06:42:59.823Z","etag":null,"topics":["epub","epub3","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fnando.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["fnando"],"custom":["https://paypal.me/nandovieira/🍕"]}},"created_at":"2024-01-25T23:49:46.000Z","updated_at":"2025-11-19T00:30:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"f2d0f715-2994-4b59-9071-175e08087215","html_url":"https://github.com/fnando/epub","commit_stats":null,"previous_names":["fnando/epub"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/fnando/epub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Fepub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Fepub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Fepub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Fepub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fnando","download_url":"https://codeload.github.com/fnando/epub/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fnando%2Fepub/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30415476,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T04:25:42.844Z","status":"ssl_error","status_checked_at":"2026-03-12T04:25:34.624Z","response_time":114,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["epub","epub3","ruby"],"created_at":"2024-10-01T16:15:43.624Z","updated_at":"2026-03-12T04:31:37.994Z","avatar_url":"https://github.com/fnando.png","language":"Ruby","funding_links":["https://github.com/sponsors/fnando","https://paypal.me/nandovieira/🍕"],"categories":[],"sub_categories":[],"readme":"# epub-rb\n\n[![Tests](https://github.com/fnando/epub/workflows/ruby-tests/badge.svg)](https://github.com/fnando/epub)\n[![Gem](https://img.shields.io/gem/v/epub-rb.svg)](https://rubygems.org/gems/epub-rb)\n[![Gem](https://img.shields.io/gem/dt/epub-rb.svg)](https://rubygems.org/gems/epub-rb)\n[![MIT License](https://img.shields.io/:License-MIT-blue.svg)](https://tldrlegal.com/license/mit-license)\n\nCreate epub files using Ruby.\n\n## Installation\n\n```bash\ngem install epub-rb\n```\n\nOr add the following line to your project's Gemfile:\n\n```ruby\ngem \"epub-rb\"\n```\n\n## Usage\n\n```ruby\nrequire \"epub\"\n\nepub = Epub.new(\n  root_dir: \"./book\",\n  title: \"Hello World\",\n  subtitle: \"A Complete Beginner’s Guide to Ruby Programming\",\n  creators: [\"John Doe\"],\n  publisher: \"epub-rb\",\n  date: \"2024-01-24\",\n  id: \"d05f92ea-62f7-44d6-bb48-d94c11e660db\",\n  copyright: \"Copyright 2024 by John Doe\",\n  identifiers: [\"915869090000000000DD\", \"urn:isbn:9780000000001\"],\n  contributors: [\"Jane Doe\"],\n  files: [\n    \"./book/book.css\",\n    \"./book/cover.png\",\n    \"./book/cover.html\",\n    \"./book/toc.html\",\n    \"./book/ch01.html\",\n    \"./book/ch02.html\",\n    \"./book/images/terminal.svg\"\n  ]\n)\n\nepub.save(\"hello-word.epub\")\n```\n\nThe epub file is compliant with the EPUB 3.3 specification. You can check it by\nusing [epubcheck](https://www.w3.org/publishing/epubcheck/).\n\n\u003e [!NOTE]\n\u003e\n\u003e epub-rb makes a few assumptions that you need to follow.\n\u003e\n\u003e 1. You need to have a file name `toc.{xhtml,html}`. This file must be\n\u003e    compliant with the EPUB 3 spec.\n\u003e 2. You'll also need a cover image named as `cover.{png,jpg,gif}`.\n\u003e 3. You'll also need a companion file called `cover.{xhtml,html}`.\n\n### Generating the Table of Contents (navigation file)\n\nYou can use the methods `Epub::Navigation.extract(files, root_dir:)` and\n`Epub::Navigation.extract_html(files, root_dir:)` to generate the `toc.html`\nfile. A simple way would be using something like this:\n\n```ruby\nnavigation = Epub::Navigation.extract_html(\n  Dir[\"./book/**/*.html\"],\n  root_dir: \"./book\"\n)\n\nFile.open(\"toc.html\", \"w\") do |file|\n  file \u003c\u003c \u003c\u003c~HTML\n    \u003c?xml version='1.0' encoding='utf-8'?\u003e\n    \u003chtml xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:epub=\"http://www.idpf.org/2007/ops\" xml:lang=\"en\" lang=\"en\"\u003e\n      \u003chead\u003e\n        \u003cmeta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/\u003e\n        \u003ctitle\u003eTable of Contents\u003c/title\u003e\n      \u003c/head\u003e\n      \u003cbody\u003e\n        #{navigation}\n      \u003c/body\u003e\n    \u003c/html\u003e\n\n  HTML\nend\n```\n\n\u003e [!NOTE]\n\u003e\n\u003e Notice that the order of `.html`/`.xhtml` files is important. You need to sort\n\u003e files how you'd like them to show up. If you add `toc.html` lastly, then it'll\n\u003e show up at the end of the ebook.\n\u003e\n\u003e Consider adding files in this order: `cover.html`, `toc.html`, all other html\n\u003e files your epub will have, then other assets (images, css, javascript, etc).\n\n## Maintainer\n\n- [Nando Vieira](https://github.com/fnando)\n\n## Contributors\n\n- https://github.com/fnando/epub/contributors\n\n## Contributing\n\nFor more details about how to contribute, please read\nhttps://github.com/fnando/epub/blob/main/CONTRIBUTING.md.\n\n## License\n\nThe gem is available as open source under the terms of the\n[MIT License](https://opensource.org/licenses/MIT). A copy of the license can be\nfound at https://github.com/fnando/epub/blob/main/LICENSE.md.\n\n## Code of Conduct\n\nEveryone interacting in the epub-rb project's codebases, issue trackers, chat\nrooms and mailing lists is expected to follow the\n[code of conduct](https://github.com/fnando/epub/blob/main/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnando%2Fepub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffnando%2Fepub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffnando%2Fepub/lists"}