A GitHub Action that automatically generates & updates markdown content (like your README.md) from external or remote files.
Ask questions in the GitHub issues ## Table of contents * [Why markdown-autodocs?](#why-markdown-autodocs) * [Features](#features) * [Examples](#examples) * [CODE Block](#code-block) * [JSON to HTML table](#json-to-html-table) * [Github Workflow Artifacts table](#github-workflow-artifacts-table) * [Example Repo which uses all the markdown-autodocs feature](#example-repo-which-uses-all-the-markdown-autodocs-feature) * [Local usage without Github action](#local-usage-without-github-action) * [Usage](#usage) * [Adding markdown-autodocs in your workflow](#adding-markdown-autodocs-in-your-workflow) * [Extended example with all possible options available for this Action](#extended-example-with-all-possible-options-available-for-this-action) * [Github Workflow Artifacts](#github-workflow-artifacts) * [Contributing](#contributing) * [Used By](#used-by) * [License](#license) ## Why markdown-autodocs To make your repo more appealing and useful you need to provide example code snippets in your README.md. Manually copy and pasting each code snippet in their respective places in your README would be inefficient and time-consuming. This problem can be solved using markdown-autodocs a GitHub Action that automatically generates & updates markdown content (like your README.md) from external or remote files. You need to add markers in your README.md that will tell markdown-autodocs where to insert the code snippet. ## Features * Code block: Insert code snippet in your markdown file from external or remote files. * JSON to HTML table: Insert HTML Table in your markdown file by converting JSON file contents to HTML table. * Github Workflow Artifacts table: Insert the Github workflow artifacts table in your markdown file by getting the latest artifacts for a workflow run. ## Examples ### CODE Block Get code from an external file or URL and insert it in your markdown. **Options:** * `src`: The relative path to the code to pull in, or the `URL` where the raw code lives * `lines` (optional): a range with lines of code which will then be replaced with code from the file. The line range should be defined as: "lines=*startLine*-*EndLine*" (for example: "lines=22-44"). Please see the example below * `syntax` (optional): Syntax will be inferred by fileType if not specified * `header` (optional): Will add header comment to code snippet. Useful for pointing to relative source directory or adding live doc links Options are concatenated via the ```&``` sign. For example ```(CODE:src=readme.md&lines=10-20)```
### JSON to HTML table
Get JSON contents from an external file and convert it into an HTML table and insert's it in your markdown.
**Options:**
* `src`: The relative path to the JSON file to pull in.
### Github Workflow Artifacts table
Get the list of the latest artifacts generated from a workflow run. Generates a workflow artifacts table consists of artifacts download and workflow URL in an HTML table and inserts it in your markdown file.
### [Example Repo which uses all the markdown-autodocs feature](https://github.com/dineshsonachalam/repo-using-markdown-autodocs)
## Local usage without Github action
**Install markdown-autodocs CLI:**
```sh
npm i -g markdown-autodocs
```
**markdown-autodocs CLI usage:**
```sh
dineshsonachalam@macbook ~ % markdown-autodocs --help
Usage: markdown-autodocs [options]
Options:
-o, --outputFilePath | Artifact | Workflow |
|---|---|
| module-dependencies-license-report | tests |
| size-of-dependencies | tests |
| vulnerabilities-audit-report | tests |