• Stars
    star
    173
  • Rank 218,860 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

✨ A GitHub Action that automatically generates & updates markdown content (like your README.md) from external or remote files.

A GitHub Action that automatically generates & updates markdown content (like your README.md) from external or remote files.

npm version MIT License

Ask questions in the GitHub issues

Table of contents

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

Local usage without Github action

Install markdown-autodocs CLI:

npm i -g markdown-autodocs

markdown-autodocs CLI usage:

dineshsonachalam@macbook ~ % markdown-autodocs --help
Usage: markdown-autodocs [options]

Options:
  -o, --outputFilePath <outputFilePaths...>  Output file paths
  -c, --category <categories...>             code-block, json-to-html-table, workflow-artifact-table
  -r, --repo <type>                          Repo name
  -b, --branch <type>                        Branch name
  -a, --accessToken <type>                   Github Access token
  -h, --help                                 display help for command
  • Code block
markdown-autodocs -c code-block -o ./README.md 
  • JSON to HTML table
markdown-autodocs -c json-to-html-table -o ./README.md
  • Github workflow artifacts table
markdown-autodocs -c workflow-artifact-table -o ./README.md -r $REPO -b $BRANCH -a $ACCESSTOKEN

Usage

Adding markdown-autodocs in your workflow

Add the following step at the end of your job, after other steps that might add or change files.

uses: dineshsonachalam/[email protected]

Extended example with all possible options available for this Action

- name: Markdown autodocs
- uses: dineshsonachalam/[email protected]
  with:
    # Optional, defaults to author of the commit that triggered the run
    commit_author: Author <[email protected]>

    # Optional, defaults to "[email protected]"
    commit_user_email: [email protected]

    # Optional, but recommended
    # Defaults to "Apply automatic changes"
    commit_message: Apply automatic changes

    # Optional branch name where commit should be pushed to.
    # Defaults to the current branch.
    branch: feature-123

    # Optional output file paths, defaults to '[./README.md]'.
    output_file_paths: '[./README.md]'

    # Categories to automatically sync or transform its contents in the markdown files.
    # Defaults to '[code-block,json-to-html-table,workflow-artifact-table]'
    categories: '[code-block,json-to-html-table,workflow-artifact-table]'

Github Workflow Artifacts

ArtifactWorkflow
module-dependencies-license-reporttests
size-of-dependenciestests
vulnerabilities-audit-reporttests

Contributing

Used By

Repo Stars Usage
Iro.js 🎨 Modular, design-conscious color picker widget for JavaScript - with support for a bunch of color formats
Fireworks.js 🎆 A simple fireworks library! Ready to use components available for React, Vue 3, Svelte, Angular, Preact, Solid, and Web Components
BPMN engine A BPMN engine, meant to be embedded in Go applications with minimal hurdles, and a pleasant developer experience using it. This approach can increase transparency for non-developers
FOSS Community Acronyms List of abbreviations used within the FOSS community, and their definitions and usages
TWallpaper 🌈 Multicolor gradient wallpaper created algorithmically and shimmers smoothly
Dusk UI Kit 🧱 Dusk UI component library
LTSM Stock Predictor Predicting different stock prices using Long Short-Term Memory Recurrent Neural Network in Python using TensorFlow 2 and Keras
PowerShell PowerShell Core Profile Directory
Mincecraft Observability extension Uses minecraft as a client for viewing observability metrics
eKonomic Research Python Toolkit A NLP Library for Social Science Research
The argument parser for bio-c++ tools The Sharg parser offers a neat and easy-to-use header-only library for argument parsing in C++

License

MIT © dineshsonachalam

More Repositories

1

tech-courses-search-engine

A real-time tech course finder, created using Elasticsearch, Python, React+Redux, Docker, and Kubernetes.
JavaScript
132
star
2

lucid-dynamodb

🗄️ A simple Python wrapper to AWS Dynamodb.
Python
107
star
3

redis-cloudflare-kv

⚡ Redis caching layer for Cloudflare KV in Golang
Go
33
star
4

gistify

Convert (almost) anything(YAML, TOML, CSV, and EXCEL) to JSON
Go
17
star
5

netflix-hackathon

Game of Thrones — Battles Analysis and Predicting Victory using Elo Rating algorithm
Python
11
star
6

repo-using-markdown-autodocs

JavaScript
6
star
7

uc-berkeley-hackathon

https://berkeley.dineshsonachalam.com/
Python
5
star
8

Tutorials-on-Keras-with-Tensorflow-Backend

Tensorflow basics
Jupyter Notebook
3
star
9

ai

Artificial intelligence in websites.
HTML
3
star
10

A-Simple-Trello-Application-in-Flask

A Trello build on Flask and SqlAlchemy
HTML
2
star
11

Elastic-search-and-flask-example

HTML
2
star
12

Github-Training-for-Product-Developers

Necessary Git understanding every programmer should know
2
star
13

Flask_simple_unittest

Python
2
star
14

Building-beautiful-REST-APIs-using-Flask-Swagger-UI-and-Flask-RESTPlus

Building REST API's using Flask, Swagger UI and Flask restful
1
star
15

Kubernetes-tutorial-for-microservices

Kubernetes-tutorial-for-microservices
1
star
16

ITMOx-I2CPx-How-to-win-coding-competitions-secrets-of-champions

1
star
17

opencv_studies

OpenCV Studies for beginner with Python
Jupyter Notebook
1
star
18

kubernetes101

Kubernetes101 for an internal lecture
Jupyter Notebook
1
star
19

Jenkins-Docker

Dockerfile
1
star
20

Ajax-Example-Flask

HTML
1
star
21

Travis-CI-Python

Python
1
star
22

Elasticsearch_highlight_query_tutorial

1
star
23

Python3_Tox_Example

Python
1
star
24

Simple_unit_test_flask_restful_api

Python
1
star
25

Python_Practice

HackerRank Python practice problems
Jupyter Notebook
1
star
26

CCDSAP

Data Structure & Algorithms
1
star
27

CLICK-CLI-Python

Python
1
star
28

Behave_testing

Python
1
star
29

IMDB_5000_Movies_Statistics_Report-

Statistical Report for 5000 IMDB movie dataset
1
star
30

DEPLOY-A-FLASK-APP-WITH-GUNICORN-AND-DOCKER

Dockerfile
1
star