:/github/workspace markdown-docs . result/
117 | ```
118 |
--------------------------------------------------------------------------------
/action.yml:
--------------------------------------------------------------------------------
1 | name: 'Markdown Docs'
2 | author: ldeluigi
3 | description: 'Generates a documentation website from Markdown files with many extensions: https://github.com/ldeluigi/markdown-docs#readme'
4 | branding:
5 | icon: 'file-text'
6 | color: 'gray-dark'
7 | inputs:
8 | src:
9 | description: >
10 | Source path.
11 | Default: .
12 | required: true
13 | default: '.'
14 | dst:
15 | description: >
16 | Output path.
17 | Default: docs
18 | required: true
19 | default: 'docs'
20 | language:
21 | description: >
22 | Language selector for mkdocs search feature and more.
23 | Default: en
24 | required: false
25 | default: 'en'
26 | icon:
27 | description: >
28 | One of https://materialdesignicons.com icons.
29 | Displayed at the top left, links to the home.
30 | Default: library
31 | required: false
32 | default: 'library'
33 | primary-color:
34 | description: >
35 | One of red, pink, purple, deep purple, indigo, blue, light blue, cyan, teal, green,
36 | light green, lime, yellow, amber, orange, deep orange.
37 | Default: indigo
38 | required: false
39 | default: indigo
40 | secondary-color:
41 | description: >
42 | One of red, pink, purple, deep purple, indigo, blue, light blue, cyan, teal, green, light green,
43 | lime, yellow, amber, orange, deep orange.
44 | Default: indigo
45 | required: false
46 | default: indigo
47 | hide-repository:
48 | description: >
49 | If set to true, will generate a website that doesn't link back to the repository on GitHub. Defaults to false.
50 | required: false
51 | default: 'false'
52 | title:
53 | description: >
54 | The title for the documentation website. Defaults to the name of the repository.
55 | required: false
56 | default: ${{ github.repository }}
57 | runs:
58 | using: 'docker'
59 | image: 'docker://deloo/markdown-docs:0.8.2'
60 | env:
61 | TITLE: ${{ inputs.title }}
62 | LANGUAGE: ${{ inputs.language }}
63 | ICON: ${{ inputs.icon }}
64 | PRIMARY_COLOR: ${{ inputs.primary-color }}
65 | SECONDARY_COLOR: ${{ inputs.secondary-color }}
66 | HIDE_REPOSITORY: ${{ inputs.hide-repository }}
67 | args:
68 | - ${{ inputs.src }}
69 | - ${{ inputs.dst }}
70 |
--------------------------------------------------------------------------------
/config/arithmatex.config.js:
--------------------------------------------------------------------------------
1 | window.MathJax = {
2 | tex: {
3 | inlineMath: [["\\(", "\\)"]],
4 | displayMath: [["\\[", "\\]"]],
5 | processEscapes: true,
6 | processEnvironments: true
7 | },
8 | options: {
9 | ignoreHtmlClass: ".*|",
10 | processHtmlClass: "arithmatex"
11 | }
12 | };
13 |
14 | document.addEventListener("DOMContentLoaded", function() {
15 | MathJax.typesetPromise()
16 | });
--------------------------------------------------------------------------------
/config/mkdocs.yml:
--------------------------------------------------------------------------------
1 | site_name: !ENV TITLE
2 | site_url: ""
3 | use_directory_urls: false
4 | docs_dir: !ENV SRC
5 | repo_url: !ENV [REPO_URL, null]
6 | edit_uri: !ENV [EDIT_URI, ""]
7 | theme:
8 | name: material
9 | custom_dir: !ENV SRC_THEME
10 | language: !ENV [LANGUAGE, "en"]
11 | icon:
12 | logo: !ENV [ICON, "material/library"]
13 | palette:
14 | - media: "(prefers-color-scheme: light)"
15 | scheme: default
16 | primary: !ENV [PRIMARY_COLOR, "indigo"]
17 | accent: !ENV [SECONDARY_COLOR, "indigo"]
18 | toggle:
19 | icon: material/toggle-switch-off-outline
20 | name: Switch to dark mode
21 | - media: "(prefers-color-scheme: dark)"
22 | scheme: slate
23 | primary: !ENV [PRIMARY_COLOR, "indigo"]
24 | accent: !ENV [SECONDARY_COLOR, "indigo"]
25 | toggle:
26 | icon: material/toggle-switch
27 | name: Switch to light mode
28 |
29 | plugins:
30 | - exclude:
31 | glob:
32 | - .git/*
33 | - search:
34 | lang: !ENV [LANGUAGE, "en"]
35 | - offline
36 | # - drawio-exporter: # Allows embeddding .drawio files
37 | # drawio_executable: /drawio.AppImage
38 | # # Diagrams are cached to speed up site generation. The default path is
39 | # # drawio-exporter, relative to the documentation directory.
40 | # cache_dir: /tmp/drawio-exporter
41 | # format: svg
42 | # embed_format: '{img_open}{img_src}{img_close}'
43 | # sources: '*.drawio'
44 | - callouts
45 | - mkdocs-jupyter:
46 | include: ["*.ipynb"]
47 | execute: false
48 | ignore_h1_titles: true
49 | include_source: true
50 | - literate-nav:
51 | nav_file: SUMMARY.md
52 | implicit_index: true
53 | - git-revision-date-localized:
54 | type: datetime
55 | timezone: UTC
56 | locale: en
57 | fallback_to_build_date: true
58 | enable_creation_date: true
59 | - git-authors:
60 | show_contribution: true
61 | show_line_count: true
62 | count_empty_lines: false
63 | fallback_to_empty: true
64 | - print-site: # Must be the last one
65 | add_to_navigation: true
66 | print_page_title: 'Print as PDF'
67 | # Table of contents
68 | add_table_of_contents: true
69 | toc_title: 'Index'
70 | toc_depth: 3
71 | # Content-related
72 | add_full_urls: false
73 | enumerate_headings: true
74 | enumerate_headings_depth: 3
75 | enumerate_figures: true
76 | path_to_pdf: ""
77 | add_print_site_banner: true
78 |
79 | markdown_extensions:
80 | - markdown_include.include:
81 | base_path: !ENV SRC
82 | inheritHeadingDepth: true
83 | throwException: false
84 | - plantuml_markdown:
85 | cachedir: /tmp # set a non-empty value to enable caching
86 | format: svg # default diagram image format
87 | classes: uml # default diagram classes
88 | title: UML diagram # default title (tooltip) for diagram images
89 | alt: UML diagram image # default `alt` attribute for diagram images
90 | priority: 100 # plugin priority; the higher, the sooner will be applied (default 23)
91 | theme: plain # default PlantUML theme
92 | plantuml_cmd: !ENV PLANTUML_CMD # path to the PlantUML jar file
93 | - pymdownx.arithmatex:
94 | generic: true
95 | - nl2br
96 | - admonition
97 | - sane_lists
98 | - pymdownx.details
99 | - pymdownx.superfences:
100 | custom_fences:
101 | - name: mermaid
102 | class: mermaid
103 | format: !!python/name:pymdownx.superfences.fence_code_format
104 | - pymdownx.highlight
105 | - pymdownx.inlinehilite
106 | - pymdownx.keys
107 | - pymdownx.tabbed
108 | - pymdownx.tasklist:
109 | custom_checkbox: true
110 | clickable_checkbox: false
111 | - abbr
112 | - footnotes
113 |
114 |
115 | extra_javascript:
116 | - js/arithmatex.config.js
117 | - https://polyfill.io/v3/polyfill.min.js?features=es6
118 | - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
--------------------------------------------------------------------------------
/config/requirements.txt:
--------------------------------------------------------------------------------
1 | mkdocs==1.6.1
2 | mkdocs-exclude==1.0.2
3 | mkdocs-material==9.6.14
4 | #mkdocs-drawio-exporter
5 | mkdocs-git-revision-date-localized-plugin==1.4.5
6 | mkdocs-git-authors-plugin==0.9.5
7 | mkdocs-print-site-plugin==2.7.2
8 | mkdocs-literate-nav==0.6.2
9 | mkdocs-jupyter==0.25.1
10 | mkdocs-callouts==1.16.0
11 | plantuml-markdown==3.11.1
12 | markdown-include==0.8.1
13 |
--------------------------------------------------------------------------------
/config/theme.404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
12 | Page Redirection
13 |
14 |
15 | If you are not redirected automatically, follow this link.
16 |
17 |
--------------------------------------------------------------------------------
/config/theme.main.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 | {% block content %}
3 | {{ super() }}
4 |
5 | {% if git_page_authors %}
6 |
7 |
8 | Authors: {{ git_page_authors | default('enable mkdocs-git-authors-plugin') }}
9 |
10 |
11 | {% endif %}
12 | {% endblock %}
13 | {% block config %}
14 | {{ super() }}
15 | {% if "localsearch" in config["plugins"] %}
16 |
17 | {% endif %}
18 | {% endblock %}
--------------------------------------------------------------------------------
/local.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 | export MSYS_NO_PATHCONV=1
5 |
6 | if [ -z "$1" -o -z "$2" ]; then
7 | echo "Usage: $0 "
8 | exit 1
9 | fi
10 |
11 | docker build -t mdocs-local .
12 | docker run --rm -e 'WORKSPACE=/github/workspace' -v "$(pwd):/github/workspace" mdocs-local "${1%/}" "${2%/}"
13 |
--------------------------------------------------------------------------------
/script/makedocs.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Fail script if a command fails
3 | set -e
4 | # Ignore safe directory errors
5 | git config --global --add safe.directory '*'
6 | # Setup
7 | WORKSPACE="${WORKSPACE:-${GITHUB_WORKSPACE:-/}}"
8 | if [ "${HIDE_REPOSITORY}" = "true" ]; then
9 | echo "Hiding repository location from documentation."
10 | unset GITHUB_REPOSITORY
11 | fi
12 | export TITLE="${TITLE:-${GITHUB_REPOSITORY:-Documentation}}"
13 | # Source folder
14 | SRC=${1#.}
15 | # Check if documentation is from GitHub
16 | if [ ! -z "${GITHUB_SERVER_URL}" -a ! -z "${GITHUB_REPOSITORY}" ] ; then
17 | export GIT=1
18 | export REPO_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}"
19 | EDIT_URI="${SRC#/}"
20 | case "${GITHUB_REF}" in
21 | refs/heads/* )
22 | BRANCH_NAME=${GITHUB_REF#refs/heads/}
23 | esac
24 | if [ ! -z "${BRANCH_NAME}" ] ; then
25 | export EDIT_URI="edit/${BRANCH_NAME}/${EDIT_URI}"
26 | fi
27 | fi
28 | export SRC=${WORKSPACE%/}/${SRC#/}
29 | # PlantUML !include root folder
30 | export PLANTUML_CMD="java -Dplantuml.include.path=${SRC} -jar /opt/plantuml/plantuml.jar"
31 | # Destination folder
32 | RELATIVE_DST=${2#.}
33 | RELATIVE_DST=${RELATIVE_DST#/}
34 | RELATIVE_DST=${RELATIVE_DST%/}
35 | DST=${WORKSPACE%/}/${RELATIVE_DST}
36 | # Temp files
37 | TMP_DST=/tmp/makedocs
38 | echo "Source: ${SRC}; Destination: ${DST};"
39 | # MkDocs default config
40 | if [ ! -z "${ICON}" ] ; then
41 | export ICON=material/${ICON##*/}
42 | fi
43 | # Generate index if absent
44 | if [ ! -f "${SRC}/index.md" -a ! -f "${SRC}/README.md" ] ; then
45 | echo "Index file (index.md) not found. It will be created using a script..."
46 | echo "# ${TITLE}" > "${SRC}/index.md"
47 | CLEAN_INDEX=true
48 | fi
49 | # Copy static template files
50 | export SRC_THEME="${SRC}/theme"
51 | mkdir -p "${SRC_THEME}" && cp -f /usr/local/src/theme.main.html "${SRC_THEME}/main.html" && cp -f /usr/local/src/theme.404.html "${SRC_THEME}/404.html"
52 | CLEAN_THEME=true
53 | # Convert docs to temp folder
54 | ( cd "${SRC}" ; mkdocs build -c -f /usr/local/src/mkdocs.yml -d "${TMP_DST}" )
55 | # Start cleanup phase
56 | echo "Cleanup..."
57 | # Copy static assets to be added
58 | mkdir -p "${TMP_DST}/js" && cp -f /usr/local/src/arithmatex.config.js "${TMP_DST}/js/arithmatex.config.js"
59 | # Prepare destination
60 | rm -rf "${DST}"
61 | # Move results to destination
62 | mv -f "${TMP_DST}" "${DST}"
63 | # Cleanup
64 | if [ "${CLEAN_INDEX}" = true ] ; then
65 | rm "${SRC}/index.md"
66 | fi
67 | if [ "${CLEAN_THEME}" = true ] ; then
68 | rm -rf "${SRC_THEME}"
69 | fi
70 | # End task
71 | echo "Done"
72 |
--------------------------------------------------------------------------------
/test/test_on_ghcr/action.yml:
--------------------------------------------------------------------------------
1 | name: 'Test on GitHub Container Registry'
2 | author: ldeluigi
3 | description: 'Generates a documentation website from Markdown files with many extensions: https://github.com/ldeluigi/markdown-docs#readme'
4 | branding:
5 | icon: 'file-text'
6 | color: 'gray-dark'
7 | inputs:
8 | src:
9 | description: >
10 | Source path.
11 | Default: .
12 | required: true
13 | default: '.'
14 | dst:
15 | description: >
16 | Output path.
17 | Default: docs
18 | required: true
19 | default: 'docs'
20 | language:
21 | description: >
22 | Language selector for mkdocs search feature and more.
23 | Default: en
24 | required: false
25 | default: 'en'
26 | icon:
27 | description: >
28 | One of https://materialdesignicons.com icons.
29 | Displayed at the top left, links to the home.
30 | Default: library
31 | required: false
32 | default: 'library'
33 | primary-color:
34 | description: >
35 | One of red, pink, purple, deep purple, indigo, blue, light blue, cyan, teal, green,
36 | light green, lime, yellow, amber, orange, deep orange.
37 | Default: indigo
38 | required: false
39 | default: indigo
40 | secondary-color:
41 | description: >
42 | One of red, pink, purple, deep purple, indigo, blue, light blue, cyan, teal, green, light green,
43 | lime, yellow, amber, orange, deep orange.
44 | Default: indigo
45 | required: false
46 | default: indigo
47 | hide-repository:
48 | description: >
49 | If set to true, will generate a website that doesn't link back to the repository on GitHub. Defaults to false.
50 | required: false
51 | default: 'false'
52 | title:
53 | description: >
54 | The title for the documentation website. Defaults to the name of the repository.
55 | required: false
56 | default: ${{ github.repository }}
57 | runs:
58 | using: 'docker'
59 | image: 'docker://ghcr.io/ldeluigi/markdown-docs'
60 | env:
61 | TITLE: ${{ inputs.title }}
62 | LANGUAGE: ${{ inputs.language }}
63 | ICON: ${{ inputs.icon }}
64 | PRIMARY_COLOR: ${{ inputs.primary-color }}
65 | SECONDARY_COLOR: ${{ inputs.secondary-color }}
66 | HIDE_REPOSITORY: ${{ inputs.hide-repository }}
67 | args:
68 | - ${{ inputs.src }}
69 | - ${{ inputs.dst }}
70 |
--------------------------------------------------------------------------------
/test/test_on_hub/action.yml:
--------------------------------------------------------------------------------
1 | name: 'Docker Hub test'
2 | author: ldeluigi
3 | description: 'Generates a documentation website from Markdown files with many extensions: https://github.com/ldeluigi/markdown-docs#readme'
4 | branding:
5 | icon: 'file-text'
6 | color: 'gray-dark'
7 | inputs:
8 | src:
9 | description: >
10 | Source path.
11 | Default: .
12 | required: true
13 | default: '.'
14 | dst:
15 | description: >
16 | Output path.
17 | Default: docs
18 | required: true
19 | default: 'docs'
20 | language:
21 | description: >
22 | Language selector for mkdocs search feature and more.
23 | Default: en
24 | required: false
25 | default: 'en'
26 | icon:
27 | description: >
28 | One of https://materialdesignicons.com icons.
29 | Displayed at the top left, links to the home.
30 | Default: library
31 | required: false
32 | default: 'library'
33 | primary-color:
34 | description: >
35 | One of red, pink, purple, deep purple, indigo, blue, light blue, cyan, teal, green,
36 | light green, lime, yellow, amber, orange, deep orange.
37 | Default: indigo
38 | required: false
39 | default: indigo
40 | secondary-color:
41 | description: >
42 | One of red, pink, purple, deep purple, indigo, blue, light blue, cyan, teal, green, light green,
43 | lime, yellow, amber, orange, deep orange.
44 | Default: indigo
45 | required: false
46 | default: indigo
47 | hide-repository:
48 | description: >
49 | If set to true, will generate a website that doesn't link back to the repository on GitHub. Defaults to false.
50 | required: false
51 | default: 'false'
52 | title:
53 | description: >
54 | The title for the documentation website. Defaults to the name of the repository.
55 | required: false
56 | default: ${{ github.repository }}
57 | runs:
58 | using: 'docker'
59 | image: 'docker://deloo/markdown-docs'
60 | env:
61 | TITLE: ${{ inputs.title }}
62 | LANGUAGE: ${{ inputs.language }}
63 | ICON: ${{ inputs.icon }}
64 | PRIMARY_COLOR: ${{ inputs.primary-color }}
65 | SECONDARY_COLOR: ${{ inputs.secondary-color }}
66 | HIDE_REPOSITORY: ${{ inputs.hide-repository }}
67 | args:
68 | - ${{ inputs.src }}
69 | - ${{ inputs.dst }}
70 |
--------------------------------------------------------------------------------
/test/test_on_self/action.yml:
--------------------------------------------------------------------------------
1 | name: 'Markdown Docs'
2 | author: ldeluigi
3 | description: 'Generates file based on documentation written in Markdown (with many extensions, see https://github.com/ldeluigi/markdown-docs#readme) based on MkDocs and Python Markdown'
4 | branding:
5 | icon: 'file-text'
6 | color: 'gray-dark'
7 | inputs:
8 | src:
9 | description: 'Source path'
10 | required: true
11 | default: '.'
12 | dst:
13 | description: 'Output path'
14 | required: true
15 | default: 'docs'
16 | language:
17 | description: >
18 | Language selector for mkdocs search feature and more.
19 | Default: en
20 | required: false
21 | default: 'en'
22 | icon:
23 | description: >
24 | One of https://materialdesignicons.com icons.
25 | Displayed at the top left, links to the home.
26 | Default: library
27 | required: false
28 | default: 'library'
29 | primary-color:
30 | description: >
31 | One of red, pink, purple, deep purple, indigo, blue, light blue, cyan, teal, green,
32 | light green, lime, yellow, amber, orange, deep orange.
33 | Default: indigo
34 | required: false
35 | default: indigo
36 | secondary-color:
37 | description: >
38 | One of red, pink, purple, deep purple, indigo, blue, light blue, cyan, teal, green, light green,
39 | lime, yellow, amber, orange, deep orange.
40 | Default: indigo
41 | required: false
42 | default: indigo
43 | hide-repository:
44 | description: >
45 | If set to true, will generate a website that doesn't link back to the repository on GitHub. Defaults to false.
46 | required: false
47 | default: 'false'
48 | title:
49 | description: >
50 | The title for the documentation website. Defaults to the name of the repository.
51 | required: false
52 | default: ${{ github.repository }}
53 | runs:
54 | using: 'docker'
55 | image: ../../Dockerfile
56 | env:
57 | TITLE: ${{ inputs.title }}
58 | LANGUAGE: ${{ inputs.language }}
59 | ICON: ${{ inputs.icon }}
60 | PRIMARY_COLOR: ${{ inputs.primary-color }}
61 | SECONDARY_COLOR: ${{ inputs.secondary-color }}
62 | HIDE_REPOSITORY: ${{ inputs.hide-repository }}
63 | args:
64 | - ${{ inputs.src }}
65 | - ${{ inputs.dst }}
66 |
--------------------------------------------------------------------------------