Mixing html and md widgets

It seems that HTML widgets are discarded when Markdown widgets are also present. Multiple Markdown widgets get concatenated automatically, but the same behavior doesn’t apply when mixing HTML and Markdown widgets.

I’d like to see consistent behavior - ideally, HTML and Markdown widgets should both render and concatenate properly when used together.

This simple snippet demonstrates the issue: the HTML widget is not rendered if a Markdown widget is also present.

widgets = widgets or {}

function widgets.testWidget1(options)
  local html = [[<span>
  <p>html widget</p>
  </span>
  ]]

  return widget.new {
    html = html
  }
end

function widgets.testWidget2(options)
  local md = "markdown widget"

  return widget.new {
    markdown = md
  }
end

event.listen {
  name = "hooks:renderTopWidgets",
  run = function(e)
    return widgets.testWidget1(nil)
  end
}

event.listen {
  name = "hooks:renderTopWidgets",
  run = function(e)
    return widgets.testWidget2(nil)
  end
}

Wait is this actually how this case behaves? I didn’t know that. Wouldn’t it be better if they just were separate widgets?

I opened a pr for it: Support mixing html and md widgets by lochel · Pull Request #1474 · silverbulletmd/silverbullet · GitHub