Baking live blocks in v2

Do we expect to be able to do this in v2? (I personally found it somewhat useful, but in ways that can be replaced with new-style templates)

Example of a new-style template that I created for this; my “monthly backups” page has sections of things to do, and I want to have a checklist for them, and easily update it to match the sections if they change. I used a heavyweight template for this before, but I figured this bit is generic enough:

local function headerChecklist()
  local headers = query[[
    from index.tag "header" where
      page == editor.getCurrentPage() and
      level == 1
      order by pos
  ]]

  return template.each(headers, template.new[==[- [ ] [[#${name}]]
]==])
end

slashcommand.define {
  name = "headerChecklist",
  run = function()
    local result = headerChecklist()
    if result then
      editor.insertAtCursor(result)
    end
  end
}

This is generic enough to not be worrying about polluting the namespace. It would be nice, however, to be able to create page-local templates, and actually instead of a “bake” button, have a “make baked copy” button (as I’d want to reuse it)… but that’s probably overly specific to my use case.

Yeah I think we can bring this back, will you create a Github issue for it?

I never used this myself, but I always like the idea of it :slight_smile:

Done, Baking expressions (v2) · Issue #1330 · silverbulletmd/silverbullet · GitHub

1 Like

If so can it please be harder to do an accidental “bake”? Several times in v1 i unintentionally baked in a query - the button is (was) too easy to hit by mistake, especially on mobile devices.