From f1c4da9824d83371d27a1543141aa5f7d2bd64e9 Mon Sep 17 00:00:00 2001 From: rahban Date: Fri, 25 Apr 2025 18:12:50 +0530 Subject: [PATCH 1/5] replaced SHA.sha with Base.hash --- src/html/HTMLWriter.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/html/HTMLWriter.jl b/src/html/HTMLWriter.jl index f22cbdf45a..7500f511ef 100644 --- a/src/html/HTMLWriter.jl +++ b/src/html/HTMLWriter.jl @@ -2396,7 +2396,7 @@ function domify(dctx::DCtx, node::Node, a::MarkdownAST.Admonition) isempty(cat_sanitized) ? "" : ".is-category-$(cat_sanitized)" end node_repr = sprint(io -> show(io, node)) - content_hash = bytes2hex(SHA.sha1(node_repr))[1:8] + content_hash = string(hash(node), base=16)[1:8] admonition_id = if !isempty(a.title) base_id = Documenter.slugify(a.title) "$(base_id)-$(content_hash)" From 153be122e912897016a263cb0b4708d03cb26681 Mon Sep 17 00:00:00 2001 From: rahban Date: Fri, 25 Apr 2025 18:35:14 +0530 Subject: [PATCH 2/5] linting and changelog --- CHANGELOG.md | 4 ++++ src/html/HTMLWriter.jl | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83354f84a8..ead9722bc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Fixed + +* changed SHA.sha to Base.hash as it was slowing the build process + ### Changed * Added anchor links to admonition blocks, making it possible to create direct links to specific admonitions. ([#2505], [#2676]) diff --git a/src/html/HTMLWriter.jl b/src/html/HTMLWriter.jl index 7500f511ef..e2ca171036 100644 --- a/src/html/HTMLWriter.jl +++ b/src/html/HTMLWriter.jl @@ -2396,7 +2396,7 @@ function domify(dctx::DCtx, node::Node, a::MarkdownAST.Admonition) isempty(cat_sanitized) ? "" : ".is-category-$(cat_sanitized)" end node_repr = sprint(io -> show(io, node)) - content_hash = string(hash(node), base=16)[1:8] + content_hash = string(hash(node), base = 16)[1:8] admonition_id = if !isempty(a.title) base_id = Documenter.slugify(a.title) "$(base_id)-$(content_hash)" From 1f7bde6df8db633ee3bd74462e5dee362ecb5f34 Mon Sep 17 00:00:00 2001 From: rahban Date: Fri, 25 Apr 2025 21:11:26 +0530 Subject: [PATCH 3/5] changelog message changed --- CHANGELOG.md | 6 +----- src/html/HTMLWriter.jl | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ead9722bc4..ce4685c83f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,13 +5,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased -### Fixed - -* changed SHA.sha to Base.hash as it was slowing the build process - ### Changed -* Added anchor links to admonition blocks, making it possible to create direct links to specific admonitions. ([#2505], [#2676]) +* Added anchor links to admonition blocks, making it possible to create direct links to specific admonitions. ([#2505], [#2676], [#2688]) * Added different banners for dev and unreleased docs ([#2382], [#2682]) ## Version [v1.10.2] - 2025-04-25 diff --git a/src/html/HTMLWriter.jl b/src/html/HTMLWriter.jl index e2ca171036..380684cf40 100644 --- a/src/html/HTMLWriter.jl +++ b/src/html/HTMLWriter.jl @@ -2396,7 +2396,7 @@ function domify(dctx::DCtx, node::Node, a::MarkdownAST.Admonition) isempty(cat_sanitized) ? "" : ".is-category-$(cat_sanitized)" end node_repr = sprint(io -> show(io, node)) - content_hash = string(hash(node), base = 16)[1:8] + content_hash = string(hash(node_repr), base = 16)[1:8] admonition_id = if !isempty(a.title) base_id = Documenter.slugify(a.title) "$(base_id)-$(content_hash)" From 3ddd659ecb5bb9fa0c5e75f707eae94e7cbbf195 Mon Sep 17 00:00:00 2001 From: rahban Date: Fri, 25 Apr 2025 21:24:35 +0530 Subject: [PATCH 4/5] padding of hash --- src/html/HTMLWriter.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/html/HTMLWriter.jl b/src/html/HTMLWriter.jl index 380684cf40..68c3629e4c 100644 --- a/src/html/HTMLWriter.jl +++ b/src/html/HTMLWriter.jl @@ -2396,7 +2396,8 @@ function domify(dctx::DCtx, node::Node, a::MarkdownAST.Admonition) isempty(cat_sanitized) ? "" : ".is-category-$(cat_sanitized)" end node_repr = sprint(io -> show(io, node)) - content_hash = string(hash(node_repr), base = 16)[1:8] + hash_str = string(hash(node_repr), base = 16) + content_hash = rpad(hash_str, 8, '0')[1:8] admonition_id = if !isempty(a.title) base_id = Documenter.slugify(a.title) "$(base_id)-$(content_hash)" From 3e0da94088f6f3be0540fcfd188a89da8afae21e Mon Sep 17 00:00:00 2001 From: rahban Date: Fri, 25 Apr 2025 21:36:57 +0530 Subject: [PATCH 5/5] now using all 16 characters --- src/html/HTMLWriter.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/html/HTMLWriter.jl b/src/html/HTMLWriter.jl index 68c3629e4c..48c851fce3 100644 --- a/src/html/HTMLWriter.jl +++ b/src/html/HTMLWriter.jl @@ -2396,8 +2396,7 @@ function domify(dctx::DCtx, node::Node, a::MarkdownAST.Admonition) isempty(cat_sanitized) ? "" : ".is-category-$(cat_sanitized)" end node_repr = sprint(io -> show(io, node)) - hash_str = string(hash(node_repr), base = 16) - content_hash = rpad(hash_str, 8, '0')[1:8] + content_hash = string(hash(node_repr), base = 16) admonition_id = if !isempty(a.title) base_id = Documenter.slugify(a.title) "$(base_id)-$(content_hash)"