{"id":15945679,"url":"https://github.com/ig3/md2epub","last_synced_at":"2025-05-07T05:47:30.045Z","repository":{"id":244357994,"uuid":"814889654","full_name":"ig3/md2epub","owner":"ig3","description":"Convert Markdown to epub","archived":false,"fork":false,"pushed_at":"2025-01-12T19:33:10.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-31T06:51:15.355Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ig3.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":"2024-06-13T23:39:30.000Z","updated_at":"2025-01-12T19:33:13.000Z","dependencies_parsed_at":"2024-06-14T08:29:52.840Z","dependency_job_id":"26ca0092-3f7e-4454-9576-c3937f59fc89","html_url":"https://github.com/ig3/md2epub","commit_stats":null,"previous_names":["ig3/md2epub"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ig3%2Fmd2epub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ig3%2Fmd2epub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ig3%2Fmd2epub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ig3%2Fmd2epub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ig3","download_url":"https://codeload.github.com/ig3/md2epub/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252823685,"owners_count":21809707,"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-07T09:05:21.998Z","updated_at":"2025-05-07T05:47:30.019Z","avatar_url":"https://github.com/ig3.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @ig3/md2epub\n\nA program to generate epub files from Markdown files.\n\n## Install\n\n$ npm install -g @ig3/md2epub\n\n## Generating an epub\n\nAdd 1 markdown file for each chapter.\n\nAdd images, including cover.jpeg and any images referred to from the\nmarkdown files.\n\nRun `md2epub`\n\n### metadata.json\n\n`md2epub` gets meta-data from a file: `metadata.json`.\n\nIf there is no metadata.json, then `md2epub` will generate one.\n\nYou can edit metadata.json and re-run `md2epub` to regenerate the epub file\nwith revised metadata.\n\nThe default metadata.json is:\n\n```\n{\n  \"title\": \"\u003cthe name of the containing folder\u003e\",\n  \"cover_image\": \"cover.jpg\"\n}\n```\n\nWhile the title is the name of the directory in which md2epub was run.\n\n### epub book\n\n`md2epub` creates an epub book from the files in the directory.\n\nThere should be one markdown file per chapter. Each markdown file is\nconverted into an xhtml file and added to the epub, in directory sort\norder. The chapter title is taken from the first top level heading in the\nfile.\n\nIf there is a corresponding image file: an image file with the same\nname as the chapter markdown file but with extension jpg, jpeg or png, and\nthis image file is not already included in the chapter, then it is added\nbefore the chapter title.\n\n### Configuration\n\nDefaults can be set in:\n * /etc/md2epub.json\n * ~/.md2epub.json\n * ~/.config/md2epub.json\n\nFor example:\n```\n{\n  \"defaultAuthor\": \"Ano Nymous\",\n  \"defaultCover\": \"cover.png\",\n  \"defaultDescription\": \"An epub from Markdown files\",\n  \"defaultLanguage\": \"EN\",\n  \"defaultTags\": [\n    \"Private\",\n    \"English\"\n  ],\n  \"defaultTitle\": \"An Untitled Work\",\n  \"defaultVerbose\": true\n}\n```\n\nIf multiple configuration files exist, they will be merged in the order\nthey are listed above with values from the latter overriding former values.\n\n\n## Motivation\n\nI wrote this for a fairly trivial reason: I was using\n[pandoc](https://pandoc.org/) to make epub books from Markdown files. It\nworked well enough but I wanted to put images before the first header of a\nchapter and I couldn't find an easy way to do that with pandoc. At each\nlevel 1 header it starts a new chapter. Anything and everything before a\nlevel 1 header is part of the preceding chapter(s). I may have been able to\ndo it if I messed with the pandoc templates. I liked the idea of using a\ngeneric tools. But it seemed less work to write this.\n\nThis might not follow the epub v3 standard very closely. I'm not familiar\nwith it. It is written in the cryptic style of all standards written by\ncompanies competing and protecting their profits. No doubt technically\ncorrect if something goes to court and one has a few decades and millions\nof dollars to debate the details, but obscuring the essence. I expect\nprofit security by obscurity. If one can't make sense of the standard, then\nthere will be less competition. At least, that's how I see it.\n\nBut epub books are simple. I didn't read the standard. I copied examples. A\nbit of XML composed by string concatenation. Some xhtml files (I wish it\nwas HTML 5). And it works well enough for\n[Calibre](https://calibre-ebook.com/),\n[Calibre-web](https://github.com/janeczku/calibre-web) and\n[@ig3/calibre-web](https://www.npmjs.com/package/@ig3/calibre-web)\n\nI'm not publishing epub books. I'm composing them purely for my own use.\nIt's an easy way to turn Markdown into epub that I can consume in my\nbrowser.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fig3%2Fmd2epub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fig3%2Fmd2epub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fig3%2Fmd2epub/lists"}