Quarto and hypothesis

I hope you are well. I am using Quartro & RStudio to develop a document. My question is, how would I be able to create a referenceable Hypothesis similar to the native functionality of theorems (see here).

I tried using a .lua file but it didn't work.


local hypothesis_counter = 1
local hypothesis_label = "Hypothesis" 

function Div(div)
  if div.classes[1] == "hypothesis" then
    local title = div.content[1].text
    local description = div.content[2].text -- Extract description text

    -- Construct the single-line content
    local content = pandoc.Strong(hypothesis_label .. " " .. hypothesis_counter .. ": ")
    content:insert(pandoc.Space())
    content:insert(pandoc.Span(title)) 
    content:insert(pandoc.Space())
    content:insert(pandoc.Span(description))

    -- Replace the div content with the single-line version
    div.content = {content}

    hypothesis_counter = hypothesis_counter + 1
  end
  return div
end

Possibly custom float can help you here

You should try it and share if this does not work as you expect.

(BTW sorry for the delay on this question)