{"id":19351510,"url":"https://github.com/lessfish/codedog","last_synced_at":"2025-02-24T10:27:22.497Z","repository":{"id":57202299,"uuid":"100849893","full_name":"lessfish/codedog","owner":"lessfish","description":"a tool to help you view live demos created by markdown","archived":false,"fork":false,"pushed_at":"2018-12-21T14:53:50.000Z","size":29,"stargazers_count":14,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-19T14:22:02.243Z","etag":null,"topics":["markdown2html"],"latest_commit_sha":null,"homepage":"","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/lessfish.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-08-20T09:01:19.000Z","updated_at":"2024-03-25T11:06:05.000Z","dependencies_parsed_at":"2022-09-17T14:52:42.395Z","dependency_job_id":null,"html_url":"https://github.com/lessfish/codedog","commit_stats":null,"previous_names":["hanzichi/codedog"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lessfish%2Fcodedog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lessfish%2Fcodedog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lessfish%2Fcodedog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lessfish%2Fcodedog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lessfish","download_url":"https://codeload.github.com/lessfish/codedog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240460485,"owners_count":19804903,"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":["markdown2html"],"created_at":"2024-11-10T04:36:30.453Z","updated_at":"2025-02-24T10:27:22.451Z","avatar_url":"https://github.com/lessfish.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# codedog\n\n## 初衷\n\n个人比较习惯用 markdown 记一些东西，有时候需要插入一些在线小 demo，最好还能在线编辑，用类似 [codepen](https://codepen.io/) 引入的话显得有些大材小用，而且第三方不保险，便希望有一种方式，能在 markdown 中写 html，并且不会相互干扰，遂有此项目\n\n我们可以比较下原始的 markdown 文件和用 codedog 二次生成后的文件：\n\n- [原始的 markdown 文件](https://github.com/hanzichi/codedog/blob/master/example/example.md)\n- [codedog 二次生成后的 html 文件](https://hanzichi.github.io/codedog/example/example.html)\n\n另外，这个项目是我为 [css-secrets](https://github.com/hanzichi/css-secrets) 特意创造的，更多应用可以点 [这里](https://github.com/hanzichi/css-secrets/blob/master/README.md) 查看\n\n## 用法\n\n该项目使用非常简单，支持模块引用和全局引用，个人推荐全局引用方式\n\n### 本地安装\n\n```bash\n$ git clone git@github.com:hanzichi/codedog.git\n$ npm install\n$ npm link\n```\n\n### npm 安装\n\n```bash\n$ npm install codedog -g\n```\n\n### 应用\n\n```bash\n$ codedog xx.md\n$ codedog xx.md width height\n```\n\n没错，codedog 几乎不提供任何参数，唯二提供的两个可选参数是在线 demo 的宽度和高度：\n\n- `width` the width of the code editor as well as other code blocks, default value is 100% of its parent node's width (`0` is the same as default)\n- `height` the height of the code editor, default value is `270px`\n\n## 开发\n\n```bash\n$ npm install\n$ npm run dev\n```\n\nrun dev 后会自动打开浏览器，打开的 url 后跟上 example.html 即可\n\n接下去在 `lib` 和 `example` 两个文件夹中修改文件，codedog 会自动编译 example.md 文件，生成新的 example.html 文件并且自动刷新打开的页面\n\n## 注意事项\n\n- 该项目用于从 markdown 生成 html，并提供某些在线编辑／预览，如果没有这个需求，说明你不需要\n- **markdown 中标注为 `html` 的代码块会被 codedog 解析**，并生成在线 demo，其余代码块不会解析\n- 被解析的代码块，支持内联 css 和 js，支持绝对路径的外链 css 和 js\n- 点击新页面打开，会在新的页面打开在线 demo\n- 页面 title 默认为第一次出现的一级标题，且 markdown 文件中一级标题只允许出现一次，且默认一级标题肯定早于其他二级标题、三级标题等出现\n- 不支持移动端，个人觉得移动端上编辑代码\u0026预览效果不方便，故不提供支持\n\n## lisence\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flessfish%2Fcodedog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flessfish%2Fcodedog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flessfish%2Fcodedog/lists"}