{"id":15893938,"url":"https://github.com/chinanf-boy/doc2md","last_synced_at":"2026-04-13T13:32:43.352Z","repository":{"id":90548215,"uuid":"104838128","full_name":"chinanf-boy/doc2md","owner":"chinanf-boy","description":"从光秃秃的文档变成 markdown 格式","archived":false,"fork":false,"pushed_at":"2017-10-19T03:19:22.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T18:16:41.014Z","etag":null,"topics":["doc2md","markdown","python"],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chinanf-boy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2017-09-26T05:02:33.000Z","updated_at":"2017-09-26T05:05:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"b2e760ed-bbb0-44b2-ae0c-d71b855b1516","html_url":"https://github.com/chinanf-boy/doc2md","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chinanf-boy/doc2md","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinanf-boy%2Fdoc2md","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinanf-boy%2Fdoc2md/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinanf-boy%2Fdoc2md/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinanf-boy%2Fdoc2md/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chinanf-boy","download_url":"https://codeload.github.com/chinanf-boy/doc2md/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chinanf-boy%2Fdoc2md/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31754967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T13:27:56.013Z","status":"ssl_error","status_checked_at":"2026-04-13T13:21:23.512Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["doc2md","markdown","python"],"created_at":"2024-10-06T08:14:06.112Z","updated_at":"2026-04-13T13:32:43.333Z","avatar_url":"https://github.com/chinanf-boy.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# doc2md\n\n[![Build Status](https://travis-ci.org/chinanf-boy/doc2md.svg?branch=master)](https://travis-ci.org/chinanf-boy/doc2md)\n\n本意是为了\n\n像\n\n---\n\n``` py\n倒序\nfor color in sorted(colors, reverse=True):\n    print colors\n\n自定义排序顺序\n\ncolors = ['red', 'green', 'blue', 'yellow']\n\ndef compare_length(c1, c2):\n    if len(c1) \u003c len(c2): return -1\n    if len(c1) \u003e len(c2): return 1\n    return 0\n\nprint sorted(colors, cmp=compare_length)\n\n更好的方法\n\nprint sorted(colors, key=len)\n\n第一种方法效率低而且写起来很不爽。另外，Python 3已经不支持比较函数了。\n\n调用一个函数直到遇到标记值\n\nblocks = []\nwhile True:\n    block = f.read(32)\n    if block == '':\n        break\n    blocks.append(block)\n```\n# 变成 下面 markdown 格式\n``` py\n# 倒序\nfor color in sorted(colors, reverse=True):\n    print colors\n\n```\n自定义排序顺序\n\n``` py\ncolors = ['red', 'green', 'blue', 'yellow']\n\ndef compare_length(c1, c2):\n    if len(c1) \u003c len(c2): return -1\n    if len(c1) \u003e len(c2): return 1\n    return 0\n\nprint sorted(colors, cmp=compare_length)\n\n```\n更好的方法\n\n``` py\nprint sorted(colors, key=len)\n\n```\n第一种方法效率低而且写起来很不爽。另外，Python 3已经不支持比较函数了。\n\n调用一个函数直到遇到标记值\n\n``` py\nblocks = []\nwhile True:\n    block = f.read(32)\n    if block == '':\n        break\n    blocks.append(block)\n\n```\n\n---\n\n## 运行文件是 ``main/doc2md.py``\n\n一步一步过程 可以使用``jupyter notebook`` 查看 ``doc2md.ipynb``\n\n首先说明缺陷就是，命令行还没有做\n请自己进入文件修改先。\n``` py\nPath = \"../让你的Python优雅.md\"\nwrite_file = '../test_w.md'\n```\n\n\n## demo 就是\n\n``` py\npython doc2md.py file1\n```\n\u003e 获取 ``让你的Python优雅.md``\n\n\u003e md格式``写``入 ``test_w.md``\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinanf-boy%2Fdoc2md","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchinanf-boy%2Fdoc2md","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinanf-boy%2Fdoc2md/lists"}