diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2f90f6278c..a6dea52211 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
# Documenter.jl changelog
+## Version `v0.24.8`
+
+* ![Enhancement][badge-enhancement] Non-standard admonition categories are (again) applied to the admonition `
` elements in HTML output (as `is-category-$category`). ([#1279][github-1279], [#1280][github-1280])
+
## Version `v0.24.7`
* ![Bugfix][badge-bugfix] Remove `only`, a new export from `Base` on Julia 1.4, from the JS search filter. ([#1264][github-1264])
@@ -529,6 +533,8 @@
[github-1258]: https://github.com/JuliaDocs/Documenter.jl/pull/1258
[github-1264]: https://github.com/JuliaDocs/Documenter.jl/pull/1264
[github-1269]: https://github.com/JuliaDocs/Documenter.jl/pull/1269
+[github-1279]: https://github.com/JuliaDocs/Documenter.jl/issues/1279
+[github-1280]: https://github.com/JuliaDocs/Documenter.jl/pull/1280
[documenterlatex]: https://github.com/JuliaDocs/DocumenterLaTeX.jl
[documentermarkdown]: https://github.com/JuliaDocs/DocumenterMarkdown.jl
diff --git a/Project.toml b/Project.toml
index 467cf69a6f..c88001ec23 100644
--- a/Project.toml
+++ b/Project.toml
@@ -1,6 +1,6 @@
name = "Documenter"
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
-version = "0.24.7"
+version = "0.24.8"
[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
diff --git a/src/Writers/HTMLWriter.jl b/src/Writers/HTMLWriter.jl
index 9689ed2077..fbb17307ab 100644
--- a/src/Writers/HTMLWriter.jl
+++ b/src/Writers/HTMLWriter.jl
@@ -1595,13 +1595,33 @@ end
function mdconvert(a::Markdown.Admonition, parent; kwargs...)
@tags header div
colorclass =
- (a.category == "danger") ? "is-danger" :
- (a.category == "warning") ? "is-warning" :
- (a.category == "note") ? "is-info" :
- (a.category == "info") ? "is-info" :
- (a.category == "tip") ? "is-success" :
- (a.category == "compat") ? "is-compat" : ""
- div[".admonition.$(colorclass)"](
+ (a.category == "danger") ? ".is-danger" :
+ (a.category == "warning") ? ".is-warning" :
+ (a.category == "note") ? ".is-info" :
+ (a.category == "info") ? ".is-info" :
+ (a.category == "tip") ? ".is-success" :
+ (a.category == "compat") ? ".is-compat" : begin
+ # If the admonition category is not one of the standard ones, we tag the
+ # admonition div element with a `is-category-$(category)` class. However, we
+ # first carefully sanitize the category name. Strictly speaking, this is not
+ # necessary when were using the Markdown parser in the Julia standard library,
+ # since it restricts the category to [a-z]+. But it is possible for the users to
+ # construct their own Admonition objects with arbitrary category strings and
+ # pass them onto Documenter.
+ #
+ # (1) remove all characters except A-Z, a-z, 0-9 and -
+ cat_sanitized = replace(a.category, r"[^A-Za-z0-9-]" => "")
+ # (2) remove any dashes from the beginning and end of the string
+ cat_sanitized = replace(cat_sanitized, r"^[-]+" => "")
+ cat_sanitized = replace(cat_sanitized, r"[-]+$" => "")
+ # (3) reduce any duplicate dashes in the middle to single dashes
+ cat_sanitized = replace(cat_sanitized, r"[-]+" => "-")
+ cat_sanitized = lowercase(cat_sanitized)
+ # (4) if nothing is left (or the category was empty to begin with), we don't
+ # apply a class
+ isempty(cat_sanitized) ? "" : ".is-category-$(cat_sanitized)"
+ end
+ div[".admonition$(colorclass)"](
header[".admonition-header"](a.title),
div[".admonition-body"](mdconvert(a.content, a; kwargs...))
)
diff --git a/src/deployconfig.jl b/src/deployconfig.jl
index 83320e8017..0696517994 100644
--- a/src/deployconfig.jl
+++ b/src/deployconfig.jl
@@ -347,7 +347,7 @@ function post_github_status(type::S, deploydocs_repo::S, sha::S, subfolder=nothi
try
Sys.which("curl") === nothing && return
## Extract owner and repository name
- m = match(r"^github.com\/(.+?)\/(.+?\.jl)(.git)?$", deploydocs_repo)
+ m = match(r"^github.com\/(.+?)\/(.+?)(.git)?$", deploydocs_repo)
m === nothing && return
owner = String(m.captures[1])
repo = String(m.captures[2])
diff --git a/test/examples/src/man/style.md b/test/examples/src/man/style.md
index bcfb96fd07..e88c5d3f3c 100644
--- a/test/examples/src/man/style.md
+++ b/test/examples/src/man/style.md
@@ -20,6 +20,12 @@ In an admonition it looks like this:
* Nulla quis venenatis justo.
* In non _sodales_ eros.
+Also, custom admonition classes can be used:
+
+!!! myadmonition "My Admonition Class"
+
+ In the HTML output, this admonition has `is-category-myadmonition` applied to it.
+
But otherwise
* Lorem ipsum dolor sit amet, consectetur adipiscing elit.
diff --git a/test/examples/tests.jl b/test/examples/tests.jl
index a915389581..b89cda4e03 100644
--- a/test/examples/tests.jl
+++ b/test/examples/tests.jl
@@ -28,10 +28,11 @@ end
@test joinpath(build_dir, "omitted", "index.html") |> isfile
@test joinpath(build_dir, "hidden", "index.html") |> isfile
@test joinpath(build_dir, "lib", "autodocs", "index.html") |> isfile
+ @test joinpath(build_dir, "man", "style", "index.html") |> isfile
# Test existence of some HTML elements
- indexhtml = String(read(joinpath(build_dir, "index.html")))
- #@test occursin("", indexhtml)
+ man_style_html = String(read(joinpath(build_dir, "man", "style", "index.html")))
+ @test occursin("is-category-myadmonition", man_style_html)
# Assets
@test joinpath(build_dir, "assets", "documenter.js") |> isfile