Skip to content

Commit

Permalink
switch to global counter
Browse files Browse the repository at this point in the history
  • Loading branch information
ffreyer committed Feb 13, 2025
1 parent f40239e commit 31f5a91
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/figure_block.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ module MakieDocsHelpers
end
end

const IMAGE_COUNTER = Ref(0)

function Documenter.Selectors.runner(::Type{FigureBlocks}, node, page, doc)
title = first(Iterators.filter(page.elements) do el
el isa Markdown.Header{1}
Expand Down Expand Up @@ -161,8 +163,8 @@ function Documenter.Selectors.runner(::Type{FigureBlocks}, node, page, doc)
end)
el.info = "@example $blockname"

backend = get(kwargs, :backend, :CairoMakie)
id = string(hash(backend, hash(el.code)), base = 16)[1:7]
id = string(hash(IMAGE_COUNTER[], hash(el.code)), base = 16)[1:7]
IMAGE_COUNTER[] += 1
el.code = transform_figure_code(el.code; id, page = page.source, pagetitle = title, is_continued, kwargs...)
Documenter.Selectors.runner(Documenter.Expanders.ExampleBlocks, node, page, doc)

Expand Down

0 comments on commit 31f5a91

Please sign in to comment.