diff --git a/.gitignore b/.gitignore
index d364e5406bb43f84703214669f0217dc684c8ca0..282ba2481521a305022e38508e4cf8021a1911c4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -85,3 +85,4 @@ doc/extra-intersphinx.txt
 doc/gridtk/
 eggs/
 sphinx/
+doc/nitpick-exceptions.txt
diff --git a/before_build.sh b/before_build.sh
index 12d48b649f5e932dcbe81f7b48c05ea6247bf2ba..d103f0ee8979a8423d8e6cb120981fa05eeaa9e8 100755
--- a/before_build.sh
+++ b/before_build.sh
@@ -23,3 +23,14 @@ sed -e '$s/$/\n/' \
     doc/*/requirements.txt \
     doc/*/test-requirements.txt \
     | sort -u > doc/extra-intersphinx.txt
+
+# Create nitpick-exceptions.txt
+# Add newlines in the end of files
+# remove comments
+# remove trailing whitespace
+sed -e '$s/$/\n/' \
+    -e 's:#.*$::g' \
+    -e 's/[[:space:]]*$//' \
+    -s \
+    doc/*/doc/nitpick-exceptions.txt \
+    | sort -u > doc/nitpick-exceptions.txt