From 60b5286f8cc7910d55aaae986e45cd3b4701fb47 Mon Sep 17 00:00:00 2001 From: Damien Duportal Date: Wed, 19 Dec 2018 17:36:04 +0100 Subject: [PATCH] Check for anchors (hashes) for external links on the documentation --- CONTRIBUTING.md | 8 ++++++++ Makefile | 9 +++++++-- docs/user-guide/swarm-mode.md | 2 +- docs/user-guide/swarm.md | 2 +- script/docs-verify-docker-image/validate.sh | 5 +++-- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ca87b0b48..fd7d89d82 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -236,6 +236,14 @@ $ make docs-clean docs-verify ... ``` +Please note that verification can be disabled by setting the environment variable `DOCS_VERIFY_SKIP` to `true`: + +```shell +DOCS_VERIFY_SKIP=true make docs-verify +... +DOCS_LINT_SKIP is true: no linting done. +``` + ## How to Write a Good Issue Please keep in mind that the GitHub issue tracker is not intended as a general support forum, but for reporting bugs and feature requests. diff --git a/Makefile b/Makefile index 02200df1e..336c5d54e 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,7 @@ TRAEFIK_IMAGE := $(if $(REPONAME),$(REPONAME),"containous/traefik") INTEGRATION_OPTS := $(if $(MAKE_DOCKER_HOST),-e "DOCKER_HOST=$(MAKE_DOCKER_HOST)", -e "TEST_CONTAINER=1" -v "/var/run/docker.sock:/var/run/docker.sock") TRAEFIK_DOC_IMAGE := traefik-docs TRAEFIK_DOC_VERIFY_IMAGE := $(TRAEFIK_DOC_IMAGE)-verify +DOCS_VERIFY_SKIP ?= false DOCKER_BUILD_ARGS := $(if $(DOCKER_VERSION), "--build-arg=DOCKER_VERSION=$(DOCKER_VERSION)",) DOCKER_RUN_OPTS := $(TRAEFIK_ENVS) $(TRAEFIK_MOUNT) "$(TRAEFIK_DEV_IMAGE)" @@ -104,8 +105,12 @@ docs: docs-image docs-build: site docs-verify: site - docker build -t $(TRAEFIK_DOC_VERIFY_IMAGE) ./script/docs-verify-docker-image ## Build Validator image - docker run --rm -v $(CURDIR):/app $(TRAEFIK_DOC_VERIFY_IMAGE) ## Check for dead links and w3c compliance +ifeq ($(DOCS_VERIFY_SKIP),false) + docker build -t $(TRAEFIK_DOC_VERIFY_IMAGE) ./script/docs-verify-docker-image + docker run --rm -v $(CURDIR):/app $(TRAEFIK_DOC_VERIFY_IMAGE) +else + @echo "DOCS_LINT_SKIP is true: no linting done." +endif site: docs-image docker run $(DOCKER_RUN_DOC_OPTS) $(TRAEFIK_DOC_IMAGE) mkdocs build diff --git a/docs/user-guide/swarm-mode.md b/docs/user-guide/swarm-mode.md index 6506fdaa0..df7ee745e 100644 --- a/docs/user-guide/swarm-mode.md +++ b/docs/user-guide/swarm-mode.md @@ -7,7 +7,7 @@ The cluster consists of: - 3 servers - 1 manager - 2 workers -- 1 [overlay](https://docs.docker.com/engine/userguide/networking/dockernetworks/#an-overlay-network) network (multi-host networking) +- 1 [overlay](https://docs.docker.com/network/overlay/) network (multi-host networking) ## Prerequisites diff --git a/docs/user-guide/swarm.md b/docs/user-guide/swarm.md index 68f720415..014ab1cd3 100644 --- a/docs/user-guide/swarm.md +++ b/docs/user-guide/swarm.md @@ -7,7 +7,7 @@ The cluster consists of: - 2 servers - 1 swarm master - 2 swarm nodes -- 1 [overlay](https://docs.docker.com/engine/userguide/networking/dockernetworks/#an-overlay-network) network (multi-host networking) +- 1 [overlay](https://docs.docker.com/network/overlay/) network (multi-host networking) ## Prerequisites diff --git a/script/docs-verify-docker-image/validate.sh b/script/docs-verify-docker-image/validate.sh index aaf3da0ec..779104111 100644 --- a/script/docs-verify-docker-image/validate.sh +++ b/script/docs-verify-docker-image/validate.sh @@ -18,9 +18,10 @@ find "${PATH_TO_SITE}" -type f -not -path "/app/site/theme/*" \ | xargs -0 -r -P "${NUMBER_OF_CPUS}" -I '{}' \ htmlproofer \ --check-html \ - --only_4xx \ + --check_external_hash \ --alt_ignore="/traefik.logo.png/" \ - --url-ignore "/localhost:/,/127.0.0.1:/,/fonts.gstatic.com/,/.minikube/,/github.com\/containous\/traefik\/*edit*/,/github.com\/containous\/traefik\/$/" \ + --http_status_ignore="0,500,501,503" \ + --url-ignore "/https://groups.google.com/a/traefik.io/forum/#!forum/security/,/localhost:/,/127.0.0.1:/,/fonts.gstatic.com/,/.minikube/,/github.com\/containous\/traefik\/*edit*/,/github.com\/containous\/traefik\/$/" \ '{}' ## HTML-proofer options at https://github.com/gjtorikian/html-proofer#configuration