{"id":19966672,"url":"https://github.com/truthhun/html2md","last_synced_at":"2025-08-01T14:04:38.645Z","repository":{"id":57482115,"uuid":"120044237","full_name":"TruthHun/html2md","owner":"TruthHun","description":"html2markdown，converts html to markdown","archived":false,"fork":false,"pushed_at":"2020-03-29T13:50:10.000Z","size":6227,"stargazers_count":79,"open_issues_count":1,"forks_count":23,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-04T00:32:09.089Z","etag":null,"topics":["html2md","markdown"],"latest_commit_sha":null,"homepage":"http://www.bookstack.cn","language":"Go","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/TruthHun.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":"2018-02-02T23:59:48.000Z","updated_at":"2025-04-22T06:59:23.000Z","dependencies_parsed_at":"2022-09-02T06:11:25.705Z","dependency_job_id":null,"html_url":"https://github.com/TruthHun/html2md","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TruthHun/html2md","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TruthHun%2Fhtml2md","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TruthHun%2Fhtml2md/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TruthHun%2Fhtml2md/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TruthHun%2Fhtml2md/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TruthHun","download_url":"https://codeload.github.com/TruthHun/html2md/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TruthHun%2Fhtml2md/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268240342,"owners_count":24218356,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["html2md","markdown"],"created_at":"2024-11-13T02:37:32.605Z","updated_at":"2025-08-01T14:04:38.604Z","avatar_url":"https://github.com/TruthHun.png","language":"Go","readme":"# html2md\nconvert html to markdown\n\n在GitHub上搜了下HTML转markdown的工具，并按照star从高到低逐个试了下，感觉不怎么符合自己的预期，索性自己写一个。\n\n\n## HTML标签\n并不是对所有的标签都做处理，比如`pre`、`blockquote`和`code`标签，这些没转成` ``` ` 或 `\u003e` 或者是` ` `，因为markdown解析器解析不会有问题。\n\n### 处理的标签\n- h1~h6\n- del\n- b\n- strong\n- i\n- em\n- dfn\n- var\n- cite\n- br\n- span\n- div\n- figure\n- p\n- article\n- nav\n- footer\n- header\n- section\n- table、thead、tbody、tr、th、td\n- ul、ol、li\n- hr\n\n### 不作处理的标签\n- pre\n- blockquote\n- code\n\n\n## 转化效果\n为了测试转化效果，我分别从github.io、gitbook、readthedoc三个站点随便提取了个正文的HTML内容，然后并将其转成markdown，看了下效果，比较符合自己的预期。\n当然，效果并不可能是100%的。\n\n## 使用方法\n\n### go语言使用\n1. 安装\n`go get github.com/TruthHun/html2md`\n1. 引入和调用\n```go\nmdStr:=html2md.Convert(htmlStr)\n```\n\n### 其他\n已经编译打包了win、mac和linux的64位的可执行文件，在`bin`目录下\n\nwindows使用：\n```\nhtml2md.exe input.html output.md\n```\n\nmac/linux使用：\n```\nhtml2md input.html output.md\n```\n\n其它语言，直接使用cmd调用二进制可执行文件对文档进行处理即可\n\n## 支持我\n如果您使用了当前包或程序，遇到问题，向我反馈就是对我最好的支持；如果项目帮到了您，给当前项目一个star，也是对我莫大的认可与支持。\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruthhun%2Fhtml2md","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftruthhun%2Fhtml2md","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruthhun%2Fhtml2md/lists"}