{"id":14986105,"url":"https://github.com/jaywcjlove/markdown-to-html-cli","last_synced_at":"2025-04-04T18:03:53.533Z","repository":{"id":37933232,"uuid":"409667713","full_name":"jaywcjlove/markdown-to-html-cli","owner":"jaywcjlove","description":"Command line tool that converts markdown to HTML.","archived":false,"fork":false,"pushed_at":"2025-01-02T18:09:40.000Z","size":6424,"stargazers_count":71,"open_issues_count":10,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-26T15:22:50.648Z","etag":null,"topics":["action","actions","cli","github-actions","html","markdown","markdown-to-html","markdown-to-html-cli","nodejs"],"latest_commit_sha":null,"homepage":"https://jaywcjlove.github.io/markdown-to-html-cli","language":"TypeScript","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/jaywcjlove.png","metadata":{"files":{"readme":"README-zh.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"ko_fi":"jaywcjlove","buy_me_a_coffee":"jaywcjlove","custom":["https://www.paypal.me/kennyiseeyou","https://jaywcjlove.github.io/#/sponsor"]}},"created_at":"2021-09-23T16:33:46.000Z","updated_at":"2025-03-13T07:38:53.000Z","dependencies_parsed_at":"2023-02-18T15:31:19.933Z","dependency_job_id":"17d505f7-0f83-4d7e-a8b7-f41b888c4408","html_url":"https://github.com/jaywcjlove/markdown-to-html-cli","commit_stats":{"total_commits":348,"total_committers":4,"mean_commits":87.0,"dds":"0.16666666666666663","last_synced_commit":"395545594ec37e80b121bb838c2b49f93d16373a"},"previous_names":[],"tags_count":104,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywcjlove%2Fmarkdown-to-html-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywcjlove%2Fmarkdown-to-html-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywcjlove%2Fmarkdown-to-html-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywcjlove%2Fmarkdown-to-html-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaywcjlove","download_url":"https://codeload.github.com/jaywcjlove/markdown-to-html-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247130010,"owners_count":20888490,"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":["action","actions","cli","github-actions","html","markdown","markdown-to-html","markdown-to-html-cli","nodejs"],"created_at":"2024-09-24T14:12:19.991Z","updated_at":"2025-04-04T18:03:53.511Z","avatar_url":"https://github.com/jaywcjlove.png","language":"TypeScript","funding_links":["https://ko-fi.com/jaywcjlove","https://buymeacoffee.com/jaywcjlove","https://www.paypal.me/kennyiseeyou","https://jaywcjlove.github.io/#/sponsor"],"categories":["TypeScript","Built on rehype"],"sub_categories":[],"readme":"markdown-to-html-cli\n===\n\u003c!--rehype:style=display: flex; height: 230px; align-items: center; justify-content: center; font-size: 38px;--\u003e\n\n[![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://jaywcjlove.github.io/#/sponsor)\n[![Downloads](https://img.shields.io/npm/dm/markdown-to-html-cli.svg?style=flat)](https://www.npmjs.com/package/markdown-to-html-cli)\n[![npm version](https://img.shields.io/npm/v/markdown-to-html-cli.svg)](https://www.npmjs.com/package/markdown-to-html-cli)\n[![Build and Test](https://github.com/jaywcjlove/markdown-to-html-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/jaywcjlove/markdown-to-html-cli/actions/workflows/ci.yml)\n[![Coverage Status](https://jaywcjlove.github.io/markdown-to-html-cli/badges.svg)](https://jaywcjlove.github.io/markdown-to-html-cli/lcov-report/)\n[![English Document](https://jaywcjlove.github.io/sb/lang/english.svg)](README.md)\n\n将 Markdown 文本转换为 HTML，提供命令行工具和方法。如果您是简单的将少量 markdown 文件（或文本）转换成 HTML 页面，这将对你很有帮助。\n\n## Usage\n\n在 Github [Actions](https://github.com/actions) 中使用。\n\n```yml\n- run: npm i markdown-to-html-cli -g\n- run: markdown-to-html --output coverage/index.html\n- run: markdown-to-html --source src/README.md --output coverage/index.html\n# or\n- name: Converts Markdown to HTML\n  uses: jaywcjlove/markdown-to-html-cli@main\n  with:\n    source: README-zh.md\n    output: coverage/action.html\n    github-corners: https://github.com/jaywcjlove/markdown-to-html-cli\n    favicon: data:image/svg+xml,\u003csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22\u003e\u003ctext y=%22.9em%22 font-size=%2290%22\u003e🌐\u003c/text\u003e\u003c/svg\u003e\n```\n\n使用命令\n\n```js\n{\n  \"scripts\": {\n    \"start\": \"markdown-to-html --output coverage/index.html\"\n  },\n  \"devDependencies\": {\n    \"markdown-to-html-cli\": \"latest\"\n  }\n}\n```\n\n在 [Nodejs](https://nodejs.org) 中使用。\n\n```js\nimport { create } from 'markdown-to-html-cli';\n\nconst html = create({\n  markdown: 'Hello World! **Bold**\\n# Title',\n  document: {\n    style: ['body { background: red; }'],\n  }\n});\n// =\u003e HTML String\n```\n\n## 安装\n\n```bash\n$ npm i markdown-to-html-cli\n```\n\n## Github [Actions](https://github.com/actions)\n\n```yml\n- name: Converts Markdown to HTML\n  uses: jaywcjlove/markdown-to-html-cli@main\n  with:\n    source: README-zh.md\n    output: coverage/action.html\n    github-corners: https://github.com/jaywcjlove/markdown-to-html-cli\n    favicon: data:image/svg+xml,\u003csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22\u003e\u003ctext y=%22.9em%22 font-size=%2290%22\u003e🌐\u003c/text\u003e\u003c/svg\u003e\n```\n\n### Input Parameters\n\n- `output` - 将静态页面输出到指定目录. (default: `index.html`)\n- `source` - 目标文件 `README.md` 的路径。 (default: `README.md`)\n- `description` - 定义你的网页的描述。\n- `config` - 指定配置文件。 (default: `package.json`)\n- `markdown` - Markdown 字符串。\n- `favicon` - 将 Favicon 添加到您的站点。\n- `github-corners` - 将 Github 角添加到您的项目页面。\n- `corners` - 展示 Github 角。 (default: `true`)\n- `dark-mode` - 禁用浅色和深色主题样式按钮。 (default: `true`)\n- `markdown-style` - Markdown 包裹样式修改. \n- `markdown-style-theme` - 设置 Markdown 风格的浅色/深色主题。\n- `style` - 覆盖默认样式。 css 文件路径或 css 字符串\n- `title` - 定义 `\u003ctitle\u003e` 文档标题的内容！\n\n### Output Parameters\n\n- `output` - 将静态页面输出到指定目录路径\n- `markdown` - Markdown 字符串\n- `html` - HTML 字符串\n\n\n## 在 package.json 中配置\n\n可以通过 `--config=\"config/conf.json\"` 指定配置，默认可以在 `package.json`。\n\n```js\n{\n  \"markdown-to-html\": {\n    \"document\": {\n      \"title\": \"markdown-to-html-cli\",\n      \"description\": \"Command line tool generates markdown as html.\",\n      \"style\": \"body { color: red; }\",\n      \"meta\": [\n        { \"description\": \"Command line tool generates markdown as html.\" },\n        { \"keywords\": \"store,localStorage,lightweight,JavaScript\" }\n      ]\n    },\n    \"favicon\": \"data:image/svg+xml,\u003csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22\u003e\u003ctext y=%22.9em%22 font-size=%2290%22\u003e🌐\u003c/text\u003e\u003c/svg\u003e\",\n    \"github-corners\": \"https://github.com/jaywcjlove/markdown-to-html-cli\",\n    \"reurls\": {\n      \"README-zh.md\": \"index.zh.html\",\n      \"README.md\": \"index.html\"\n    }\n  }\n}\n```\n\n- [`name`](https://github.com/jaywcjlove/markdown-to-html-cli/blob/308ca37aa5b9ae846a7835092a183d0ed73a8dc4/package.json#L2) -\u003e `'markdown-to-html'.title` - 定义 `\u003ctitle\u003e` 文档标题内容！\n- [`description`](https://github.com/jaywcjlove/markdown-to-html-cli/blob/308ca37aa5b9ae846a7835092a183d0ed73a8dc4/package.json#L4) -\u003e `'markdown-to-html'.description` - 定义您的网页的描述。\n- [`repository.url`](https://github.com/jaywcjlove/markdown-to-html-cli/blob/308ca37aa5b9ae846a7835092a183d0ed73a8dc4/package.json#L22) -\u003e `'markdown-to-html'.github-corners` - 在你的项目页面添加一个 Github Corners。\n- [`keywords`](https://github.com/jaywcjlove/markdown-to-html-cli/blob/308ca37aa5b9ae846a7835092a183d0ed73a8dc4/package.json#L24-L30) -\u003e `'markdown-to-html'.document.meta` - 定义搜索引擎的关键字。\n\n## 命令帮助\n\n```bash\nUsage: markdown-to-html [options] [--help|h]\n\nOptions:\n\n  --author                Define the author of a page.\n  --config, -o            Specify the configuration file. Default: \"\u003cprocess.cwd()\u003e/package.json\".\n  --description           Define a description of your web page.\n  --favicon               Add a Favicon to your Site.\n  --github-corners        Add a Github corner to your project page.\n  --github-corners-fork   Github corners style.\n  --keywords              Define keywords for search engines.\n  --no-dark-mode          Disable light and dark theme styles button.\n  --markdown              Markdown string.\n  --style                 Override default styles. css file path or css string.\n  --markdown-style-theme  Setting markdown-style light/dark theme.\n  --output, -o            Output static pages to the specified directory. Default: \"index.html\"\n  --source, -s            The path of the target file \"README.md\". Default: \"README.md\"\n  --title                 The `\u003ctitle\u003e` tag is required in HTML documents!\n  --version, -v           Show version number\n  --help, -h              Displays help information.\n\nExample:\n\n  npm markdown-to-html-cli\n  npm markdown-to-html     --title=\"Hello World!\"\n  npm markdown-to-html     --config=\"config/conf.json\"\n  npm markdown-to-html-cli --markdown=\"Hello World!\"\n  npm markdown-to-html-cli --no-dark-mode\n  npm markdown-to-html-cli --markdown-style-theme dark\n  npm markdown-to-html-cli --github-corners https://github.com/jaywcjlove/markdown-to-html-cli\n  npm markdown-to-html-cli --github-corners https://github.com/jaywcjlove --github-corners-fork\n  npm markdown-to-html-cli --output coverage/index.html\n  npm markdown-to-html-cli --source README.md\n  npm markdown-to-html-cli --source README.md --style=./style.css\n  npm markdown-to-html-cli --source README.md --style='body { color: red; }'\n```\n\n## Markdown Features\n\n### 支持 CSS 样式定义\n\n使用 HTML 注释 [`\u003c!--rehype:xxx--\u003e`](https://github.com/jaywcjlove/rehype-attr)\u003c!--rehype:style=color: red;--\u003e 让 Markdown 支持样式自定义。\n\n```markdown\n## Title\n\u003c!--rehype:style=display: flex; height: 230px; align-items: center; justify-content: center; font-size: 38px;--\u003e\n\nMarkdown Supports **Style**\u003c!--rehype:style=color: red;--\u003e\n```\n\n### 支持 [GFM 注脚](https://github.blog/changelog/2021-09-30-footnotes-now-supported-in-markdown-fields/)\n\n```markdown\nHere is a simple footnote[^1]. With some additional text after it.\n\n[^1]: My reference.\n```\n\n### [任务清单](https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#task-lists)\n\n要创建任务列表，请在列表项前添加一个常规空格字符，后跟 `[ ]`。要将任务标记为完成，请使用 `[x]`。\n\n```markdown\n- [x] #739\n- [ ] https://github.com/octo-org/octo-repo/issues/740\n- [ ] Add delight to the experience when all tasks are complete :tada:\n```\n\nIf a task list item description begins with a parenthesis, you'll need to escape it with `\\`:\n\n```markdown\n- [ ] \\(Optional) Open a followup issue\n```\n\n## API\n\n```ts\nimport { ParsedArgs } from 'minimist';\nimport { Options } from 'rehype-document';\nexport interface CreateOptions extends MDToHTMLOptions { }\nexport declare function create(options?: CreateOptions): string;\nexport interface RunArgvs extends Omit\u003cParsedArgs, '_'\u003e {\n  version?: string;\n  source?: string;\n  output?: string;\n  /** Add a Github corner to your project page. */\n  'github-corners'?: string;\n  /** Github corners style. */\n  'github-corners-fork'?: boolean;\n  /** Markdown string. */\n  markdown?: string;\n  /** The `\u003ctitle\u003e` tag is required in HTML documents! */\n  title?: string;\n  /** Specify the configuration file. Default: `\u003cprocess.cwd()\u003e/package.json` */\n  config?: string;\n  /** Define a description of your web page */\n  description?: string;\n  /** Define keywords for search engines */\n  keywords?: string;\n  /** Add a Favicon to your Site */\n  favicon?: string;\n  /** Define the author of a page */\n  author?: string;\n}\nexport interface MDToHTMLOptions extends RunArgvs {\n  /** [rehype-document](https://github.com/rehypejs/rehype-document#options) options */\n  document?: Options;\n  /** Rewrite Element. [rehype-rewrite](https://github.com/jaywcjlove/rehype-rewrite#rewritenode-index-parent-void) */\n  rewrite?: RehypeRewriteOptions['rewrite'];\n  /** rewrite URLs of href and src attributes. */\n  reurls?: Record\u003cstring, string\u003e;\n}\nexport declare function run(opts?: Omit\u003cRunArgvs, \"_\"\u003e): any;\nexport declare const cliHelp: string;\nexport declare const exampleHelp: string;\n```\n\n## Development\n\n```bash\n$ npm i\n$ npm run build\n$ npm run watch\n```\n\n## Contributors\n\nAs always, thanks to our amazing contributors!\n\n\u003ca href=\"https://github.com/jaywcjlove/markdown-to-html-cli/graphs/contributors\"\u003e\n  \u003cimg src=\"https://jaywcjlove.github.io/markdown-to-html-cli/CONTRIBUTORS.svg\" /\u003e\n\u003c/a\u003e\n\nMade with [github-action-contributors](https://github.com/jaywcjlove/github-action-contributors).\n\n## License\n\nMIT © [Kenny Wong](https://wangchujiang.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaywcjlove%2Fmarkdown-to-html-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaywcjlove%2Fmarkdown-to-html-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaywcjlove%2Fmarkdown-to-html-cli/lists"}