Home

Awesome

Markdown Docs

The same readme, built with this: here!

CI/CD GitHub code size in bytes Docker Pulls GitHub marketplace GitHub release (latest by date including pre-releases)

This repository contains the definition of a Docker image that can be used both as a builder stage and as an action.

markdown-docs is implemented as a jam of stuff you don't even need to know about. Just assume that everything is supported until you find that it's not, then submit an issue to add support for even that thing. Only if you really need it.

Supported Markdown extensions:

Supported plugins

Usage

You can use markdown-docs both as a GitHub Acton or a Docker builder stage inside your dockerfile.

As GitHub Action

To use markdown-docs as a GitHub Action, use the following syntax in your workflow:

      - name: Generate HTML from Markdown
        uses: ldeluigi/markdown-docs@latest
        with:
          src: doc
          dst: generated

This means that every markdown file inside the doc folder in the current workspace will be converted and mapped to a corresponding HTML file inside the generated directory. You can pass . as src to search the entire repo for markdown files. dst folder will be emptied before generation.

Additional information

In order to make the "last edit date" plugin work you need to clone the full history of your documentation inside your CI. With GitHub actions this can be done using the option fetch-depth: 0 with the actions/checkout@v3 step.

Complete usage example with all the parameters

      - name: Generate HTML from Markdown
        uses: ldeluigi/markdown-docs@latest
        with:
          src: doc
          dst: generated
          title: Markdown Docs
          language: en
          icon: library
          primary-color: indigo
          secondary-color: indigo
          hide-repository: false
Additional parameters info

As Docker builder

To use markdown-docs as a Docker builder stage use the following syntax in your Dockerfile:

FROM deloo/markdown-docs AS builder

COPY docs/ /home/src
ENV WORKSPACE=/home
RUN makedocs "src" "dst"

FROM ...

COPY --from=builder /home/dst /var/www/static/

This means that first docker stage creates a container where it runs the makedocs script, then will copy the resulting, generated HTML files in the production image, specifically in /var/www/static. This can be useful for your static website hosting. See the Wiki for more examples.

Environment variables

There are some environment variables that control the behaviour of the builder. These are:

ENV WORKSPACE=/home
# Optionals (with their default values)
ENV TITLE=Markdown Docs
ENV LANGUAGE=en
ENV ICON=library
ENV PRIMARY_COLOR=indigo
ENV SECONDARY_COLOR=indigo
ENV HIDE_REPOSITORY=false

Notes about documenting your software

The idea behind markdown-docs is that all the documentation that can be written in separate files from the code should be mantained like the code documentation, that is thinking about the content and not the appearence. In addition, some of the most important tools for documentation are UML diagrams. In particular, one of the most maintainable way to draw UMLs is PlantUML, which can generate UML diagrams for a text specification.
One of the most important features of markdown-docs is the support of PlantUML syntax embedded inside documentation sources, in Markdown.

Contributing

Fork this project and make PRs, if you can't you can create an issue.

Local tests

With Docker (suggested):

docker build -t markdown-docs . --no-cache
docker run -e WORKSPACE=/github/workspace -v <YOUR-CURRENT-WORKING-DIRECTORY>:/github/workspace markdown-docs . result/