Skip to content

Extract content of bullet list out #9532

Answered by tarleb
jirijakes asked this question in Q&A
Discussion options

You must be logged in to vote

This is what I came up with:

local function flatten (list)
  local result = {}
  for i, item in ipairs(list) do
    for j, block in ipairs(item) do
      result[#result + 1] = block
    end
  end
  return result
end

function BulletList(list)
  if list.content[1][1].t == 'Header' and list.content[1][1].level == 3 then
    return flatten(list.content)
  end
end

Does it do what you need?

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@jirijakes
Comment options

Answer selected by jirijakes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants