diff --git a/CHANGELOG.md b/CHANGELOG.md index a3bb5f31dd..dcd6e61999 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ * ![Enhancement][badge-enhancement] The generated HTML site now displays a footer by default that mentions Julia and Documenter. This can be customized or disabled by passing the `footer` keyword to `Documeter.HTML`. ([#1184][github-1184], [#1365][github-1365]) +* ![Enhancement][badge-enhancement] Warnings that cause `makedocs` to error when `strict=true` are now printed as errors when `strict` is set to `true`. ([#1088][github-1088], [#1349][github-1349]) + ## Version `v0.25.0` * ![Enhancement][badge-enhancement] When deploying with `deploydocs`, any SSH username can now be used (not just `git`), by prepending `username@` to the repository URL in the `repo` argument. ([#1285][github-1285]) @@ -543,6 +545,7 @@ [github-1077]: https://github.com/JuliaDocs/Documenter.jl/pull/1077 [github-1081]: https://github.com/JuliaDocs/Documenter.jl/issues/1081 [github-1082]: https://github.com/JuliaDocs/Documenter.jl/pull/1082 +[github-1088]: https://github.com/JuliaDocs/Documenter.jl/issues/1088 [github-1089]: https://github.com/JuliaDocs/Documenter.jl/pull/1089 [github-1094]: https://github.com/JuliaDocs/Documenter.jl/pull/1094 [github-1097]: https://github.com/JuliaDocs/Documenter.jl/pull/1097 @@ -598,6 +601,7 @@ [github-1339]: https://github.com/JuliaDocs/Documenter.jl/pull/1339 [github-1344]: https://github.com/JuliaDocs/Documenter.jl/issues/1344 [github-1345]: https://github.com/JuliaDocs/Documenter.jl/pull/1345 +[github-1349]: https://github.com/JuliaDocs/Documenter.jl/pull/1349 [github-1355]: https://github.com/JuliaDocs/Documenter.jl/pull/1355 [github-1357]: https://github.com/JuliaDocs/Documenter.jl/pull/1357 [github-1360]: https://github.com/JuliaDocs/Documenter.jl/pull/1360 diff --git a/src/DocChecks.jl b/src/DocChecks.jl index 66476224cf..0ee8eae66f 100644 --- a/src/DocChecks.jl +++ b/src/DocChecks.jl @@ -13,6 +13,9 @@ import ..Documenter: using DocStringExtensions import Markdown +using Logging +loglevel(doc) = doc.user.strict ? Logging.Error : Logging.Warn + # Missing docstrings. # ------------------- @@ -60,7 +63,7 @@ function missingdocs(doc::Documents.Document) end end push!(doc.internal.errors, :missing_docs) - @warn String(take!(b)) + @logmsg loglevel(doc) String(take!(b)) end end @@ -123,17 +126,17 @@ function footnotes(doc::Documents.Document) # Multiple footnote bodies. if bodies > 1 push!(doc.internal.errors, :footnote) - @warn "footnote '$id' has $bodies bodies in $(Utilities.locrepr(page.source))." + @logmsg loglevel(doc) "footnote '$id' has $bodies bodies in $(Utilities.locrepr(page.source))." end # No footnote references for an id. if ids === 0 push!(doc.internal.errors, :footnote) - @warn "unused footnote named '$id' in $(Utilities.locrepr(page.source))." + @logmsg loglevel(doc) "unused footnote named '$id' in $(Utilities.locrepr(page.source))." end # No footnote bodies for an id. if bodies === 0 push!(doc.internal.errors, :footnote) - @warn "no footnotes found for '$id' in $(Utilities.locrepr(page.source))." + @logmsg loglevel(doc) "no footnotes found for '$id' in $(Utilities.locrepr(page.source))." end end end @@ -176,7 +179,7 @@ function linkcheck(doc::Documents.Document) end else push!(doc.internal.errors, :linkcheck) - @warn "linkcheck requires `curl`." + @logmsg loglevel(doc) "linkcheck requires `curl`." end end return nothing @@ -203,7 +206,7 @@ function linkcheck(link::Markdown.Link, doc::Documents.Document; method::Symbol= result = read(cmd, String) catch err push!(doc.internal.errors, :linkcheck) - @warn "$cmd failed:" exception = err + @logmsg loglevel(doc) "$cmd failed:" exception = err return false end STATUS_REGEX = r"^(\d+) (\w+)://(?:\S+) (\S+)?$"m @@ -234,11 +237,11 @@ function linkcheck(link::Markdown.Link, doc::Documents.Document; method::Symbol= return linkcheck(link, doc; method=:GET) else push!(doc.internal.errors, :linkcheck) - @error "linkcheck '$(link.url)' status: $(status)." + @logmsg loglevel(doc) "linkcheck '$(link.url)' status: $(status)." end else push!(doc.internal.errors, :linkcheck) - @warn "invalid result returned by $cmd:" result + @logmsg loglevel(doc) "invalid result returned by $cmd:" result end end return false