From e9238e7797bc77080f2b41d4fa087084483d996b Mon Sep 17 00:00:00 2001 From: Mohd Rahban Ghani Date: Wed, 9 Apr 2025 14:02:09 +0530 Subject: [PATCH 1/3] Remove at-meta, at-setup, at-docs from search index (#2675) Co-authored-by: Morten Piibeleht (cherry picked from commit e20db94ff1b9bae2946bd58244fff041ff7f0cbb) --- CHANGELOG.md | 6 ++++++ src/html/HTMLWriter.jl | 20 ++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffbec90626..8c71d778fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +## Fixed + +* `@meta`, `@setup`, and `@docs` blocks no longer generate spurious entries in the search index. ([#1929], [#2675]) + ## Version [v1.10.1] - 2025-03-31 ### Fixed diff --git a/src/html/HTMLWriter.jl b/src/html/HTMLWriter.jl index 8f17884332..f1ca4619bd 100644 --- a/src/html/HTMLWriter.jl +++ b/src/html/HTMLWriter.jl @@ -713,6 +713,20 @@ function SearchRecord(ctx, navnode, node::Node, ::MarkdownAST.AbstractElement) return SearchRecord(ctx, navnode; text = mdflatten(node)) end +# Returns nothing for nodes that shouldn't be indexed in search +const _SEARCHRECORD_IGNORED_BLOCK_TYPES = Union{ + Documenter.MetaNode, + Documenter.DocsNodesBlock, + Documenter.SetupNode, +} +function searchrecord(ctx::HTMLContext, navnode::Documenter.NavNode, node::Node) + # Skip indexing special at-blocks + if node.element isa _SEARCHRECORD_IGNORED_BLOCK_TYPES + return nothing + end + return SearchRecord(ctx, navnode, node, node.element) +end + function JSON.lower(rec::SearchRecord) # Replace any backslashes in links, if building the docs on Windows src = replace(rec.src, '\\' => '/') @@ -1680,8 +1694,10 @@ end function domify(dctx::DCtx) ctx, navnode = dctx.ctx, dctx.navnode return map(getpage(ctx, navnode).mdast.children) do node - rec = SearchRecord(ctx, navnode, node, node.element) - push!(ctx.search_index, rec) + rec = searchrecord(ctx, navnode, node) + if !isnothing(rec) + push!(ctx.search_index, rec) + end domify(dctx, node, node.element) end end From 5b8f9af7c18020c9458cb6130c98d6e9a3e4ff79 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 25 Apr 2025 06:16:19 +0200 Subject: [PATCH 2/3] Fix performance regression in clear_modules! (#2685) (cherry picked from commit 3684e46a5caaadba062448616433253f8b46918b) --- CHANGELOG.md | 3 ++- src/expander_pipeline.jl | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c71d778fc..a8a3cff0cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased -## Fixed +### Fixed * `@meta`, `@setup`, and `@docs` blocks no longer generate spurious entries in the search index. ([#1929], [#2675]) +* Fixed a performance regression introduced in v1.10.0 as part of the code clearing out the sandbox modules to save memory and caused by calling `GC.gc()` too often. ([#2685]) ## Version [v1.10.1] - 2025-03-31 diff --git a/src/expander_pipeline.jl b/src/expander_pipeline.jl index 547d94d3cb..a7f02c582c 100644 --- a/src/expander_pipeline.jl +++ b/src/expander_pipeline.jl @@ -24,7 +24,6 @@ function clear_modules!(d::Dict{Symbol, Any}) startswith(String(k), "__atexample__") || continue v isa Module && clear_module!(v) end - GC.gc() return end From b298f5cb0ca3f697650285426c2e421d149f2f1d Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Fri, 25 Apr 2025 16:25:40 +1200 Subject: [PATCH 3/3] Set version to 1.10.2 --- CHANGELOG.md | 7 ++++++- Project.toml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8a3cff0cd..d15a56ad67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## Version [v1.10.2] - 2025-04-25 ### Fixed @@ -1469,6 +1469,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [v1.8.1]: https://github.com/JuliaDocs/Documenter.jl/releases/tag/v1.8.1 [v1.9.0]: https://github.com/JuliaDocs/Documenter.jl/releases/tag/v1.9.0 [v1.10.0]: https://github.com/JuliaDocs/Documenter.jl/releases/tag/v1.10.0 +[v1.10.1]: https://github.com/JuliaDocs/Documenter.jl/releases/tag/v1.10.1 +[v1.10.2]: https://github.com/JuliaDocs/Documenter.jl/releases/tag/v1.10.2 [#198]: https://github.com/JuliaDocs/Documenter.jl/issues/198 [#245]: https://github.com/JuliaDocs/Documenter.jl/issues/245 [#487]: https://github.com/JuliaDocs/Documenter.jl/issues/487 @@ -1838,6 +1840,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#1912]: https://github.com/JuliaDocs/Documenter.jl/issues/1912 [#1919]: https://github.com/JuliaDocs/Documenter.jl/issues/1919 [#1924]: https://github.com/JuliaDocs/Documenter.jl/issues/1924 +[#1929]: https://github.com/JuliaDocs/Documenter.jl/issues/1929 [#1930]: https://github.com/JuliaDocs/Documenter.jl/issues/1930 [#1931]: https://github.com/JuliaDocs/Documenter.jl/issues/1931 [#1932]: https://github.com/JuliaDocs/Documenter.jl/issues/1932 @@ -2013,6 +2016,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#2659]: https://github.com/JuliaDocs/Documenter.jl/issues/2659 [#2662]: https://github.com/JuliaDocs/Documenter.jl/issues/2662 [#2674]: https://github.com/JuliaDocs/Documenter.jl/issues/2674 +[#2675]: https://github.com/JuliaDocs/Documenter.jl/issues/2675 +[#2685]: https://github.com/JuliaDocs/Documenter.jl/issues/2685 [JuliaLang/julia#36953]: https://github.com/JuliaLang/julia/issues/36953 [JuliaLang/julia#38054]: https://github.com/JuliaLang/julia/issues/38054 [JuliaLang/julia#39841]: https://github.com/JuliaLang/julia/issues/39841 diff --git a/Project.toml b/Project.toml index 4f0e21c44d..10eb774f48 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Documenter" uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4" -version = "1.10.1" +version = "1.10.2" [deps] ANSIColoredPrinters = "a4c015fc-c6ff-483c-b24f-f7ea428134e9"