{"id":22202091,"url":"https://github.com/syfxlin/docset-generator","last_synced_at":"2025-07-27T04:31:29.379Z","repository":{"id":42832901,"uuid":"265256916","full_name":"syfxlin/docset-generator","owner":"syfxlin","description":" :pencil: Dash 文档生成器（内含制作完成的中文文档）","archived":false,"fork":false,"pushed_at":"2022-12-11T06:37:40.000Z","size":815,"stargazers_count":19,"open_issues_count":16,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-03T08:33:18.535Z","etag":null,"topics":["dash","dash-docset","docset","docset-cn"],"latest_commit_sha":null,"homepage":"https://ixk.me","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/syfxlin.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":"2020-05-19T13:37:14.000Z","updated_at":"2022-12-27T11:43:07.000Z","dependencies_parsed_at":"2023-01-26T17:15:19.844Z","dependency_job_id":null,"html_url":"https://github.com/syfxlin/docset-generator","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syfxlin%2Fdocset-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syfxlin%2Fdocset-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syfxlin%2Fdocset-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syfxlin%2Fdocset-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syfxlin","download_url":"https://codeload.github.com/syfxlin/docset-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227760005,"owners_count":17815626,"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":["dash","dash-docset","docset","docset-cn"],"created_at":"2024-12-02T16:12:23.280Z","updated_at":"2024-12-02T16:12:23.799Z","avatar_url":"https://github.com/syfxlin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docset-generator\n\n\u003e Dash 文档生成器\n\n制作好的文档我会传到 [Release](https://github.com/syfxlin/docset-generator/releases) 如果有刚好需要的可以直接使用。\n\n## 制作方式\n\n### 1. 镜像站点\n\n镜像工具有很多，不过我只推荐使用 [HTTrack](http://www.httrack.com/)\n\n支持的平台：OS X / Windows/Linux/Unix/BSD\n\n镜像站点的时候要注意排除无关的资源和链接，比如 Vue 的文档导向了 Github 仓库，我们就需要将其排除。\n\n另外由于镜像站点会给对应的站点带去不必要的负担，所以还是建议限制下镜像的速度。\n\n**如果官方已经提供了离线的文档那么就可以直接使用，不需要再镜像站点。**\n\nHTML 的文档和 CHM 的文档都可以制作成 Dash 文档，CHM 文档解包后可以得到 HTML 文档，但是需要注意将文件编码转换成 UTF-8。\n\n### 2. 放入指定的路径\n\n依次将资源重命名并放入 `docs` 和 `icons` 目录\n\n### 3. 编写生成的配置文件\n\n在 `config` 文件夹创建对应名称的 `js` 文件。本工具已经将 Dash 文档制作的过程简化了，您只需要编写生成 **目录索引** 和 **过滤器** 的代码。\n\n#### 参数\n\n`insertToDb` 会将目录插入到 Dash 文档的 SQLite 数据库中，使用 Dash 开启文档的时候会在侧栏显示索引。\n\n`addDashAnchor` 是添加对应 Dash 锚点的函数\n\n`$` 是解析 HTML 后的 Document，具体使用方法查阅 `cheerio`\n\n`docset` 是用户传入的配置，对应 config 的 export\n\n`relativePath` 是相对路径\n\n#### 钩子\n\n执行顺序从上到下：\n\n`beforeParse({ path, html })` 在解析 HTML 之前执行，需要返回 HTML\n\n`beforeGenerateToc({ $, relativePath, addDashAnchor, docset })` 在生成目录之前执行\n\n`generateToc({ $, relativePath, addDashAnchor, docset, insertToDb })` 生成目录，只有该方法可以插入到数据库\n\n`beforeFilter({ $, relativePath, addDashAnchor, docset })` 前置过滤器\n\n`filter({ $, relativePath, addDashAnchor, docset })` 过滤器\n\n`afterFilter({ $, relativePath, addDashAnchor, docset })` 后置过滤器\n\n`beforeWrite({ path, html })` 在 HTML 写入到文件之前执行，需要返回 HTML\n\n具体请自行查看样例进行编写。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyfxlin%2Fdocset-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyfxlin%2Fdocset-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyfxlin%2Fdocset-generator/lists"}