{"id":25126156,"url":"https://github.com/cmry/markdoc","last_synced_at":"2025-04-23T07:15:17.800Z","repository":{"id":89446811,"uuid":"48884346","full_name":"cmry/markdoc","owner":"cmry","description":"Convert NumPy-styled Python docstring to Markdown.","archived":false,"fork":false,"pushed_at":"2016-01-11T07:29:51.000Z","size":19,"stargazers_count":12,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T07:15:12.026Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/cmry.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":"2016-01-01T17:22:23.000Z","updated_at":"2025-03-29T09:20:14.000Z","dependencies_parsed_at":"2023-03-17T15:00:13.845Z","dependency_job_id":null,"html_url":"https://github.com/cmry/markdoc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmry%2Fmarkdoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmry%2Fmarkdoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmry%2Fmarkdoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmry%2Fmarkdoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cmry","download_url":"https://codeload.github.com/cmry/markdoc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250386840,"owners_count":21422040,"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":[],"created_at":"2025-02-08T09:19:19.016Z","updated_at":"2025-04-23T07:15:17.772Z","avatar_url":"https://github.com/cmry.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MarkDoc\n\nThis piece of code can be used to convert\n[NumPy-styled](https://sphinxcontrib-napoleon.readthedocs.org/en/latest/example_numpy.html) Python docstrings ([example](https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/neural_network/multilayer_perceptron.py#L134)),\nsuch as those used in [scikit-learn](https://www.scikit-learn.org/), to\nMarkdown with minimum dependencies. In this way, only the code-contained\ndocumentation needs to be editted, and your documentation on for example\n[readthedocs](http://www.readthedocs.org/) can be automatically updated\nthereafter with some configuration.\n\n## Example\n\nThe converted documentation for this particular code can be found\n[here](https://github.com/cmry/markdoc/blob/master/markdoc.md).\n\n## Before Use\n\nThe format assumes that your code (or at least your docstring documentation) is\nin line with the styleguides of *both* PEP8 and PEP257. There are two ways to\ngo about making sure this is the case:\n\n#### Fast\n\nJust check the example\n[here](https://github.com/cmry/markdoc/blob/master/markdoc.py#L304) to get a\nquick overview of how the docstrings would have to look in order for them\nto parse correctly.\n\n#### Better\n\nThe styleguides are incorporated into two libraries that can be used to check\nthe Python files for style errors in terminal, like so:\n\n``` shell\npip install pep8\npip install pep257\n\npep8 yourpythonfile.py\npep257 yourpythonfile.py\n```\n\nThese are more conveniently implemented in linter plugins such as `linter-pep8`\nand `linter-pep257` for the [linter](https://atom.io/users/AtomLinter/packages)\npackage in [Atom](http://www.atom.io/), and\n[Flake8Lint](https://github.com/dreadatour/Flake8Lint) for\n[Sublime Text](https://www.sublimetext.com/) (and pretty much every other IDE).\n\n\n## Usage\n\nFirst clone from GitHub:\n\n``` shell\ngit clone https://www.github.com/cmry/markdoc\n```\n\nTo use the script within terminal, simply type:\n\n``` shell\npython3 markdoc.py /dir/to/somefile.py /dir/to/somedoc.md\n```\n\nIf you want to automatically generate a bunch of documentation and are not\ncomfortable with writing `.sh` scripts, you can use the code in Python as well:\n\n``` python\nfrom markdoc import MarkDoc\nmd = MarkDoc('/dir/to/somefile.py', '/dir/to/somedoc.md')\n```\n\nYou can access the converted markdown string in:\n\n``` python\n# print markdown from class attribute\nprint(md.markdown)\n```\n\nThe class runs itself on initialization (calls `self.read`). If you do not\nwant this, you can add `cold=True` to the class initialization, like so:\n\n``` python\nmd = MarkDoc('file.py', 'doc.md', cold=True)\n```\n\n## Planned Fixes\n\n- Handle consecutive classes within the same file.\n- Fix inherrited classes being handled correctly (no `__init__`, no `object`).\n- Link class methods from table to their documentation.\n- Might not handle decorators neatly.\n\n## Docstring Issues\n\nSome caveats:\n\n- Do not use `\"\"\"` for anything other than docstrings.\n- First line of any docstring has to contain the first short title\n  ([example](https://github.com/cmry/markdoc/blob/master/markdoc.py#L162)).\n- Classes have to be structured new-style: `class SomeClass(object):`.\n- Codeblocks in examples have to be vanilla Python (`\u003e\u003e\u003e` and `...`).\n- Please do not use `class` as a parameter name!\n\n## Notes\n\nScript has only been tested with Python 3.4 on Ubuntu.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmry%2Fmarkdoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcmry%2Fmarkdoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmry%2Fmarkdoc/lists"}