From a82ee0fd1b92c08ea1addf5b254a2320c13a7e48 Mon Sep 17 00:00:00 2001 From: jholdstock Date: Fri, 5 Jan 2024 08:26:30 +0000 Subject: [PATCH] Update mkdocs-material to 9.5.3. Include generating social cards, lots of minor bug fixes, a smaller docker image, faster build times, and using a new emoji extension. --- .github/workflows/docker.yml | 2 +- .github/workflows/python.yml | 4 ++-- Dockerfile | 14 +++++++++++--- mkdocs.yml | 20 ++++++++++++++++++-- requirements.txt | 4 ++-- 5 files changed, 34 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c1af4c8..677e818 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,6 +5,6 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Build the Docker image run: docker build -t decred/dcrdevdocs:$(date +%s) . diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index fea9654..eb69a0a 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -9,9 +9,9 @@ jobs: python-version: [3.11] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/Dockerfile b/Dockerfile index 7b96514..34bf2d4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM python:3.11 LABEL description="dcrdevdocs build" LABEL version="1.0" -LABEL maintainer "holdstockjamie@gmail.com" +LABEL maintainer "jholdstock@decred.org" USER root WORKDIR /root @@ -15,14 +15,22 @@ COPY ./ /root/ RUN pip install mkdocs && \ pip install --user -r requirements.txt +# Install dependencies for generating social cards. +# https://squidfunk.github.io/mkdocs-material/setup/setting-up-social-cards +RUN apt update && \ + apt install libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev && \ + pip install pillow cairosvg + +ENV DCRDEVDOCS_CARDS true + RUN ./bin/build_docs.sh # Serve image (stable nginx version) -FROM nginx:1.22-alpine +FROM nginx:1.24-alpine LABEL description="dcrdevdocs serve" LABEL version="1.0" -LABEL maintainer "holdstockjamie@gmail.com" +LABEL maintainer "jholdstock@decred.org" COPY conf/nginx.conf /etc/nginx/conf.d/default.conf diff --git a/mkdocs.yml b/mkdocs.yml index d94eecb..3b6c89d 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,5 +1,15 @@ site_name: Decred Developer Documentation +site_url: https://devdocs.decred.org use_directory_urls: true +validation: + # Increase severity of validation rules to trigger build failures on common mistakes. + absolute_links: warn + unrecognized_links: warn + nav: + omitted_files: warn + absolute_links: warn +watch: + - "docs" theme: name: material favicon: 'img/favicon.ico?v=s3ss' @@ -68,14 +78,20 @@ markdown_extensions: - attr_list - pymdownx.details - pymdownx.emoji: - emoji_index: !!python/name:materialx.emoji.twemoji - emoji_generator: !!python/name:materialx.emoji.to_svg + emoji_index: !!python/name:material.extensions.emoji.twemoji + emoji_generator: !!python/name:material.extensions.emoji.to_svg extra_css: - css/fonts.css - css/style.css plugins: - markdownextradata - search + - social: + enabled: !ENV [DCRDEVDOCS_CARDS, false] + cards_layout_options: + font_family: 'Source Sans 3' + background_color: '#091440' + color: '#FFFFFF' nav: - 'Home': 'index.md' - 'Projects': 'projects.md' diff --git a/requirements.txt b/requirements.txt index 2afedc3..b5bf3a9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -mkdocs-material==9.0.6 -mkdocs-markdownextradata-plugin==0.2.4 +mkdocs-material==9.5.3 +mkdocs-markdownextradata-plugin==0.2.5