Your approach will work if you wrap everything in context()
. Right now the context will return content (which it always does, see this post if you want to learn more about the details), causing the error on compilation.
Note that counter.final()
always returns an array of integers. I therefore had to append .at(0)
to get the first element from the array.
#context {
if counter(figure.where(kind: table)).final().at(0) > 0 {
outline(
title: [List of Tables],
target: figure.where(kind: table),
)
}
}
I would also ask you to move your post to the Questions category. The title is already great.