轻量级降价代码文档生成器

markdowndocs的Python项目详细描述


降价文档

markdowndocs是一个轻量级的降价文档生成器,它生成一个简单的.md文件,该文件基于docstring和原始代码记录代码。在


Installation and usage| Usage| Using markdowndocs with pre-commit| Contributor guidelines| Code documentation


安装和使用

安装

安装方式:

pip install markdowndocs

用法

选项

要在工作目录中的所有模块上运行markdowndocs,请执行以下操作:

^{pr2}$

要在工作目录中的特定模块上运行markdowndocs,请执行以下操作:

$ markdowndocs --module-names <my_module>

要在工作目录中的所有模块上运行markdowndocs,除了特定的模块,请执行以下操作:

$ markdowndocs --exclude-modules <my_module>

完整选项和使用:

$ markdowndocs --help
usage: markdowndocs [-h] [--output-file-name NAME] [--add-to-readme]
                    [--exclude-dependencies] [--exclude-code] [--version]
                    (-a | -m NAME [NAME ...] | -e NAME [NAME ...])

Markdown documentation package.

optional arguments:
  -h, --help            show this help message and exit
  --output-file-name NAME
                        Use this option to specify a custom output file name
                        for the .md documentation [default:
                        code_documentation.md]
  --add-to-readme       If enabled, adds a link to your documentation file to
                        your README.md file with the following format: ## Code
                        documentation [Code
                        Documentation](code_documentation.md) [default: False]
  --exclude-dependencies
                        If enabled, includes a list of dependencies for each
                        module. [default: False]
  --exclude-code        If enabled, excludes the raw code for each function.
                        [default: False]
  --version             Show version information and exit.
  -a, --all             Use this option to generate documentation for all
                        modules in your current working directory [default:
                        False]
  -m NAME [NAME ...], --module-names NAME [NAME ...]
                        Use this option to generate documentation for a
                        specific module or modules
  -e NAME [NAME ...], --exclude-modules NAME [NAME ...]
                        Use this option to exclude a specific module or
                        multiple modules from the documentation generator

输出

默认情况下,生成的降价文档存储在名为code_documentation.md的文件中。可以使用--output-file-name参数设置自定义文件名。 默认情况下,输出中包含以下内容:

  • 用于模块、类和函数(包括私有方法)的用户定义docstring
  • 所有模块、类和函数的内部链接和嵌套内容表
  • 每个模块的依赖项(即导入)列表
  • 每个函数的原始代码。在

示例

Markdowndocs输出:

已知限制

  • markdowndocs将只在工作目录中的目录中拾取模块,而不会在子目录中拾取模块(即当前只支持一个级别的“嵌套”)
  • markdowndocs假设代码中的所有导入都正常工作,即不引用不存在的模块。在
  • markdowndocs不能很好地与{a12}配合。在

markdowndocs与预提交挂钩一起使用

要在每次新提交时使用markdowndocs生成最新文档,请将以下配置添加到.pre-commit-config.yaml文件中(并在args字段中添加首选配置选项):

repos:
-   repo: https://github.com/ngoet/markdowndocs
    rev: 0.1.0
    hooks:
    - id: markdowndocs
      pass_filenames: false
      args: ["-m", "<my-module-name>",
             "--add-to-readme"]

贡献者指南

欢迎提出改进建议。如果您发现任何内容已损坏,或希望提出更改建议,请打开问题。在

代码文档

Code documentation

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java不兼容类型:MainActivity无法转换为LifecycleOwner   java安卓是一种更有效的读取大文本文件的方法   java导出LWJGL本地人与项目?(IntelliJ IDEA)   JDK更新后,JavaJShell不再在下一行打印输出   父类对象上的继承Java比较子属性   Java:有没有一个容器可以有效地结合HashMap和ArrayList?   安卓 Java对象指针   java在annotationdriven Spring MVC应用程序中实现大气   java 安卓源代码构建应用找不到安卓supportv4。罐子   文件系统上的抽象层和Java中的jar/zip   java在水平滚动视图中添加多个图像?   java如何从firebase实时数据库中获取字符串数组   WIndows 10工作站上的java未满足链接错误   java命令在终端中工作,但在使用过程中出现“无结束引号”错误。执行官