{"id":25458658,"url":"https://github.com/javiorfo/zig-epub","last_synced_at":"2025-11-02T21:30:35.224Z","repository":{"id":277891517,"uuid":"917446726","full_name":"javiorfo/zig-epub","owner":"javiorfo","description":"Minimal Zig library for creating EPUB files","archived":false,"fork":false,"pushed_at":"2025-02-16T19:49:29.000Z","size":41,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-16T20:29:37.728Z","etag":null,"topics":["epub","epub-library","zig","zig-library"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/javiorfo.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":"2025-01-16T02:07:28.000Z","updated_at":"2025-02-16T19:52:36.000Z","dependencies_parsed_at":"2025-02-16T20:40:48.129Z","dependency_job_id":null,"html_url":"https://github.com/javiorfo/zig-epub","commit_stats":null,"previous_names":["javiorfo/zig-epub"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javiorfo%2Fzig-epub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javiorfo%2Fzig-epub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javiorfo%2Fzig-epub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javiorfo%2Fzig-epub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/javiorfo","download_url":"https://codeload.github.com/javiorfo/zig-epub/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239401120,"owners_count":19632120,"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":["epub","epub-library","zig","zig-library"],"created_at":"2025-02-18T03:20:13.146Z","updated_at":"2025-11-02T21:30:35.168Z","avatar_url":"https://github.com/javiorfo.png","language":"Zig","readme":"# zig-epub\n*Minimal Zig library for creating EPUB files*\n\n## Caveats\n- C libs dependencies: [libzip 1.11.2](https://github.com/nih-at/libzip) \n- Required Zig version: **0.13**\n- Epub version: `2.0.1`\n- This library has been developed on and for `Linux` following open source philosophy.\n\n## Overview\nThis library will generate an epub with the current compressed files:\n- **META-INF/**\n    - **container.xml**\n- **OEBPS/**\n    - **images/**\n    - **toc.ncx**\n    - **content.opf**\n    - **SomeChapter.xhtml**\n    - **stylesheet.css**\n- **mimetype**\n\n**NOTE:** Only one level of subchapter is available when using Table of Contents at the moment. Ex: Chapter 1 -\u003e Chapter 1.1, Chapter 1.2, etc.\n\n## Usage\n- Simple example. More [examples here](https://github.com/javiorfo/zig-epub/tree/master/examples)\n```zig\nconst std = @import(\"std\");\nconst epub = @import(\"epub\");\n\npub fn main() !void {\n    var gpa = std.heap.GeneralPurposeAllocator(.{}){};\n    defer if (gpa.deinit() != .ok) @panic(\"leak\");\n    const allocator = gpa.allocator();\n\n    var my_epub = epub.Epub.init(allocator, .{\n        .title = \"Flying Circus\",\n        .creator = \"Johann Gambolputty\",\n        .identifier = .{\n            .identifier_type = .UUID,\n            .value = \"d5b2b585-566a-4b9c-9c5d-f99436e3a588\",\n        },\n    });\n    defer my_epub.deinit();\n\n    var image_paths = [_][]const u8{\n        \"/home/user/Downloads/image.jpg\",\n        \"/home/user/Downloads/image2.png\",\n    };\n\n    var section = epub.Section.init(allocator, \"Chapter 1\", .{ .raw = \"\u003ch1\u003eChapter 1\u003c/h1\u003e\\n\u003cp\u003eHello\u003c/p\u003e\\n\u003ch1 id=\\\"chapter1.1\\\"\u003eChapter 1.1\u003c/h1\u003e\" });\n    defer section.deinit();\n\n    try my_epub\n        .setStylesheet(.{ .raw = \"body { background-color: #000000 }\" })\n        .setCoverImage(.{ .path = \"/home/user/Downloads/cats.jpg\", .image_type = .jpg })\n        .setImages(\u0026image_paths)\n        .setCover(.{ .raw = \"\u003cdiv class=\\\"cover\\\"\u003e\u003cimg src=\\\"images/cats.jpg\\\" alt=\\\"Cover Image\\\"/\u003e\u003c/div\u003e\" })\n        .addSectionType(\"Preface\", .{ .raw = \"\u003cp\u003epreface\u003c/p\u003e\\n\" }, .Preface)\n        .add(section.addToc(.{ .text = \"Chapter 1.1\", .reference_id = \"chapter1.1\" }).build())\n        .addSection(\"Chapter 2\", .{ .raw = \"\u003ch1\u003eChapter 2\u003c/h1\u003e\\n\u003cp\u003eBye\u003c/p\u003e\\n\" })\n        .generate(\"book.epub\");\n}\n```\n\n## Installation\n#### In `build.zig.zon`:\n```zig\n.dependencies = .{\n    .epub = .{\n        .url = \"https://github.com/javiorfo/zig-epub/archive/refs/heads/master.tar.gz\",            \n        // .hash = \"hash suggested\",\n        // the hash will be suggested by zig build\n    },\n}\n```\n\n#### In `build.zig`:\n```zig\nconst dep = b.dependency(\"epub\", .{\n    .target = target,\n    .optimize = optimize,\n});\nexe.root_module.addImport(\"epub\", dep.module(\"epub\"));\n\nexe.linkLibC();\nexe.linkSystemLibrary(\"zip\");\n```\n\n---\n\n### Donate\n- **Bitcoin** [(QR)](https://raw.githubusercontent.com/javiorfo/img/master/crypto/bitcoin.png)  `1GqdJ63RDPE4eJKujHi166FAyigvHu5R7v`\n- [Paypal](https://www.paypal.com/donate/?hosted_button_id=FA7SGLSCT2H8G)\n","funding_links":["https://www.paypal.com/donate/?hosted_button_id=FA7SGLSCT2H8G"],"categories":["Libraries","Language Essentials"],"sub_categories":["File Format Processing"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaviorfo%2Fzig-epub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaviorfo%2Fzig-epub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaviorfo%2Fzig-epub/lists"}