{"id":16232172,"url":"https://github.com/ryanfitzgerald/ebook-generator","last_synced_at":"2025-04-08T06:46:34.097Z","repository":{"id":44407950,"uuid":"299139071","full_name":"RyanFitzgerald/ebook-generator","owner":"RyanFitzgerald","description":"Generate PDF ebooks from Markdown files easily","archived":false,"fork":false,"pushed_at":"2024-11-11T22:34:22.000Z","size":616,"stargazers_count":35,"open_issues_count":0,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-14T04:32:12.275Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"ofl-1.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RyanFitzgerald.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-09-27T23:35:21.000Z","updated_at":"2025-01-30T04:46:19.000Z","dependencies_parsed_at":"2025-02-14T04:29:34.623Z","dependency_job_id":"645bb55e-c15a-4793-b851-a177e7d0b379","html_url":"https://github.com/RyanFitzgerald/ebook-generator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanFitzgerald%2Febook-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanFitzgerald%2Febook-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanFitzgerald%2Febook-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanFitzgerald%2Febook-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RyanFitzgerald","download_url":"https://codeload.github.com/RyanFitzgerald/ebook-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247792919,"owners_count":20996896,"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":[],"created_at":"2024-10-10T13:08:17.203Z","updated_at":"2025-04-08T06:46:34.078Z","avatar_url":"https://github.com/RyanFitzgerald.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ebook Generator\n\nEbook generator is a build pipeline made with Node.js that takes in a series of Markdown files and generates one final PDF output. In order to make it all work, it uses a combination of `showdownjs` (convert MD to HTML), `puppeteer` (HTML to PDF), and `highlight.js` (code highlighting).\n\nThe build pipeline consists of 3 steps:\n\n1. Combining all Markdown files found in `/content` into one `output/book.md` (handled in `scripts/combine.js`)\n2. Converting the combined Markdown file to HTML in `output/book.html` (handled in `scripts/convert-to-html.js`)\n3. Converting the generated HTML file into a final PDF in `output/book.pdf` (handled in `scripts/generate-pdf.js`)\n\n## Available Scripts\n\n- `combine`: combines all Markdown files into a single file\n- `convert`: converts the combined Markdown file into a HTML output\n- `generate`: takes the generated HTML output and generates a PDF\n- `build`: runs the above commands in the correct order\n\n## Demo\n\nYou can download the example output PDF by [clicking here](https://github.com/RyanFitzgerald/ebook-generator/raw/master/output/book.pdf).\n\n## Getting Started\n\nExample outputs can be found in the `/output` directory. More specifically, `output/book.pdf` represents the final generated PDF.\n\nIn order to get started, clone the repo and install dependencies by running `npm install`.\n\nNext, add your content (in the form of .md files) in the `/content` directory. The order of files in this directory represents the order in which the files get merged together, so it may require you to prefix them with numbers to force an order.\n\nFinally, once you have your content (or if you just want to test), run a `npm run build` to generate the PDF. This process should take a couple of seconds.\n\n## Configuration\n\nThe project's `.env` file contains overall configuration, which is currently just your book's name.\n\nIf you wish to configure settings related to the combining of Markdown files, check out the file in `scripts/combine.js`. Examples of configuration may be adding additional content between each file merge such as the page breaks currently included.\n\nMarkdown to HTML conversion is done via the `showdownjs` library and can be found in `scripts/convert-to-html.js`. If you wish to alter configuration for the conversion, that can be found in this file.\n\nFinally, HTML to PDF conversion is done via `puppeteer` and can be found in `scripts/generate-pdf.js`. If you want to configure the puppeteer settings, it can be found in this file (such as Page Headers and Footers, hiding backgrounds, etc).\n\n## Styles\n\nSince the PDF generation works by first converting to HTML and then to PDF, you can customize the styles of the PDF (to a degree). The current styles can be found in the `/styles` directory. The styles that currently exist are `normalize.css` (to normalize styles), `highlight.css` (styles for the code blocks), and finally `styles.css` (the general styles). Fonts are also added locally to fix render and text selection problems in preview and browsers after generation.\n\nIt's also important to note that the Page Header and Footer styles are added inline within `scripts/generate-pdf.js` as they are added on generation by puppeteer and don't technically exist in the HTML when being generated.\n\n## License \n\nThe scripts are all licensed under MIT. Use them however you want!\n\nInter Font is licensed under SIL OPEN FONT LICENSE. See `OFL.txt` for more.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanfitzgerald%2Febook-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanfitzgerald%2Febook-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanfitzgerald%2Febook-generator/lists"}