{"id":18313978,"url":"https://github.com/oreillymedia/gulp-htmlbook","last_synced_at":"2025-04-09T12:27:34.313Z","repository":{"id":33309201,"uuid":"36953942","full_name":"oreillymedia/gulp-htmlbook","owner":"oreillymedia","description":"Gulp plugins for handling htmlbook content","archived":false,"fork":false,"pushed_at":"2016-03-24T18:43:09.000Z","size":296,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-03-15T11:07:29.867Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oreillymedia.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}},"created_at":"2015-06-05T20:29:09.000Z","updated_at":"2018-04-13T03:42:34.000Z","dependencies_parsed_at":"2022-08-07T20:30:31.103Z","dependency_job_id":null,"html_url":"https://github.com/oreillymedia/gulp-htmlbook","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/oreillymedia%2Fgulp-htmlbook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oreillymedia%2Fgulp-htmlbook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oreillymedia%2Fgulp-htmlbook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oreillymedia%2Fgulp-htmlbook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oreillymedia","download_url":"https://codeload.github.com/oreillymedia/gulp-htmlbook/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248038599,"owners_count":21037552,"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-11-05T16:29:22.808Z","updated_at":"2025-04-09T12:27:29.305Z","avatar_url":"https://github.com/oreillymedia.png","language":"HTML","readme":"# gulp HTMLBook\n\nContains gulp plugins to convert from HTMLBook to HTML.\n\n## layout\n### layout.template()\nLayout content in a templates, and replace variables in the content\n### layout.ordering()\nAdds `prev_url`, `next_url`, `prev_label`, `next_label` variables to each file\n### layout.navigation()\nCreate the navigation html by passing the nav json through a template\n### layout.index()\nCreate the index html by passing the index json through a template\n### layout.chunk()\nSplit the content from a single HTMLBook file into chunks, at the chapter or section level\n\n## generate\n### generate.map()\nRun through a stream of documents and generate reference objects for each file and every id, returns json\n### generate.index()\nFind all index terms in a stream of documents and sort them, returns json\n### generate.nav()\nFind all the headers in a stream of documents and create the nav for the Table of Contents, returns json.\n\n## process\nprocesses parts of the content, most require content to have been mapped\n### process.ids()\nAdds ids for all `chapter`, `section`, `a[data-type='indexterm']`, `div[data-type]`, `aside`, `figure` elements that don't have one.\n### process.indexterms()\nRemoves spaces from indexterm elements\n### process.labels()\nReplaces headers with nice labels, such as Section 1.2\n### process.admonitions()\nAdds translated header text to admonition elements (`en` only for now)\n### process.comments()\nRemoves comments\n### process.xrefs()\nReplaces cross-refrenced link with the correct url and text\n### process.escape()\nReplaces cdata in pre elements, escapes their content\n\n## tools\n### tools.helpers()\nCollection of helper functions\n### tools.mapper()\nMap a document\n### tools.generateid()\nGenerates Id's based on hashed content, these will always be the same if the content is the same.\n\n### Installation\n\n```javascript\nnpm install gulp-htmlbook\n```\n\n```javascript\nvar htmlbook = require(\"gulp-htmlbook\");\n```\n\n###Usage\n\nSee the example gulpfile.js for how to process a sample HTMLBook source.\n\nA compile task should process the source content and output it for mapping and templating.\nIf the content is in markdown, asciidoc or docbook it must be transformed prior to this step.\n```javascript\nvar outputPath = \"compiled/\";\n\ngulp.task('compile', [], function() {\n  return gulp.src(\"*.html\")\n    .pipe(htmlbook.process.ids())\n    .pipe(htmlbook.process.indexterms())\n    .pipe(htmlbook.process.admonitions())\n    .pipe(htmlbook.process.comments())\n    .pipe(gulp.dest(outputPath));\n});\n```\nNext map the compiled content. This map is used with many other plugins.\n```javascript\nvar order = require('gulp-order');\ngulp.task('map', ['compile'], function() {\n  return gulp.src(outputPath+\"*.html\")\n    .pipe(order(['chap_1.html','chap_2.html'])) // Must be ordered\n    .pipe(htmlbook.generate.map())\n    .pipe(gulp.dest(outputPath));\n});\n```\nFinaly, wrap each chunk in an html template.\n```javascript\ngulp.task('template', ['compile', 'map'], function() {\n  var map = require(\"./map.json\"); // Load the map\n\n  return gulp.src(outputPath+\"*.html\")\n    .pipe(htmlbook.layout.ordering(['chap_1.html','chap_2.html'], map))\n    .pipe(htmlbook.layout.template())\n    .pipe(gulp.dest(outputPath));\n});\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foreillymedia%2Fgulp-htmlbook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foreillymedia%2Fgulp-htmlbook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foreillymedia%2Fgulp-htmlbook/lists"}