dostring function equivalent

Hello.
I used dostring function to execute code in string.

I will do this


PlotaDiario = function()
  local s = [==[
---
${columns( preenche_semana2(editor.getCurrentPage()) ) }

Últimas mofificadas
${template.each (query[[from index.tag "page" order by lastModified desc limit 10]], templates.pageItem) }
]==]
  return s
end

in a day page I put
${ PlotaDiario() }

I will use to execute the code when the page is open.
${ dostring(PlotaDiario()) }

How can a do this?
Thanks.

Hey, I’m not 100% sure what you are trying to accomplish, but I got this to work. What you want here is not to evaluate your string as Lua code, but as markdown.

Note: I had to fix a bug to make this work, so please be sure to upgrade to the latest v2 commit.


```space-lua
function PlotaDiario()
  local s = [==[
Últimas mofificadas
${template.each (query[[from index.tag "page" order by lastModified desc limit 10]], templates.pageItem) }
]==]
  local parsed = markdown.parseMarkdown(s)
  -- This replaces the ${...} stuff with actual values
  local expanded = markdown.expandMarkdown(parsed)
  return markdown.renderParseTree(expanded)
end
```

${PlotaDiario()}

Thank you…
How can I do this?
I installed the binary (.exe) for Win64.
Do I have to download the source code and compile it?

I think I found the binary at Release edge · silverbulletmd/silverbullet · GitHub : silverbullet-server-windows-x86_64.zip
I’ll try it…
Thank you very much.

I tested it here and it returned the error.

Últimas mofificadas
Error: Error evaluating “name”: _GLOBAL not defined

In that case you don’t havethe latest version, this is exactly the error I fixed. Have you reloaded your browser a few times, the old version may also be cached.


My goal is to run a function that renders multiple blocks.

Dynamic day panel:

tasks
latest modifications
active projects
etc.

For dynamic use in the diary.

If I want to change the layout or include a block, I just change it in the main (dynamic panel) function.

This way, the day page has two areas:

permanent notes


dynamic panel


I’m trying to execute two functions on the same line that return two blocks. One is Markdown and the other is HTML…
The interpreter only renders one.

${ UltimasModificadas().. ’ \n ’ .. painelTarefasSemana() }

The result is this.

{markdown = Últimas modificadas
* [[xlib/func/teste1]]
* [[xlib/func/teste]]
* [[DIARIO/2025/08/2025-08-19]]
* [[@PAGAR]]
* [[01 FAZ_FINANCAS]]
* [[xlib/func/date_func]]
* [[xlib/func/menu_func]]
* [[DIARIO/2025/08/2025-08-16]]
* [[@desktop]]
* [[xtest/input_test]]

, display = block, cssClasses = {my-map}, _isWidget = true} 
 {html = <div class="row"><div contenteditable="false" class="column"><h3 style="border-left:1px solid grey;background-color:#a7d5e3;"><a style="margin:3px;" href='DIARIO/2025/08/1899-11-26'>1899-11-26 dom</a></h3></div><div contenteditable="false" class="column"><h3 style="border-left:1px solid grey;background-color:#a7d5e3;"><a style="margin:3px;" href='DIARIO/2025/08/1899-11-27'>1899-11-27 seg</a></h3></div><div contenteditable="false" class="column"><h3 style="border-left:1px solid grey;background-color:#a7d5e3;"><a style="margin:3px;" href='DIARIO/2025/08/1899-11-28'>1899-11-28 ter</a></h3></div><div contenteditable="false" class="column"><h3 style="border-left:1px solid grey;background-color:#a7d5e3;"><a style="margin:3px;" href='DIARIO/2025/08/1899-11-29'>1899-11-29 qua</a></h3></div><div contenteditable="false" class="column"><h3 style="border-left:1px solid grey;background-color:#a7d5e3;"><a style="margin:3px;" href='DIARIO/2025/08/1899-11-30'>1899-11-30 qui</a></h3></div><div contenteditable="false" class="column"><h3 style="border-left:1px solid grey;background-color:#a7d5e3;"><a style="margin:3px;" href='DIARIO/2025/08/1899-12-01'>1899-12-01 sex</a></h3></div><div contenteditable="false" class="column"><h3 style="border-left:1px solid grey;background-color:#a7d5e3;"><a style="margin:3px;" href='DIARIO/2025/08/1899-12-02'>1899-12-02 sab</a></h3></div></div>, display = block, cssClasses = {my-map}, _isWidget = true}

I tested combining two Markdown blocks and both render.
${ UltimasModificadas().markdown.. ' \n ' .. UltimasModificadas().markdown }

If I pass only the HTML, it renders.
${ painelTarefasSemana() }

But when I pass two, and one of them is HTML, it doesn’t render.
${ painelTarefasSemana() .. ' \n ' .. painelTarefasSemana() }
or
${ painelTarefasSemana().html .. ' \n ' .. painelTarefasSemana().html }

Regarding this issue, I found a related post…

It seems to me that the solution was called ArrayWidget mentioned in

But I believe one solution would be to pass a lua table with each HTML or Markdown code block…

${ widget.list{
function() blablabla end,
function() blablabla end,
query(),
‘<a>blablabla</a>‘
}

Is this already implemented?
Or is there a similar solution?

Thanks for your attention.