# dostring function equivalent

**URL:** https://community.silverbullet.md/t/dostring-function-equivalent/3049
**Category:** Lua
**Created:** [August 19, 2025, 6:41am UTC](https://community.silverbullet.md/t/dostring-function-equivalent/3049 "2025-08-19T06:41:59Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![marcoswur](https://community.silverbullet.md/letter_avatar_proxy/v4/letter/m/a87d85/32.png) [@marcoswur](https://community.silverbullet.md/u/marcoswur)
#### Post date: [August 19, 2025, 6:41am UTC](https://community.silverbullet.md/t/dostring-function-equivalent/3049/1 "2025-08-19T06:41:59Z")

</div>

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

I will do this

```space-lua

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.

---

<div class="post-metadata">

### Author: ![zef](https://community.silverbullet.md/user_avatar/community.silverbullet.md/zef/32/7_2.png) [@zef](https://community.silverbullet.md/u/zef)
#### Post date: [August 19, 2025, 7:58am UTC](https://community.silverbullet.md/t/dostring-function-equivalent/3049/2 "2025-08-19T07:58:49Z")

</div>

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.

````auto

```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()}

````

---

<div class="post-metadata">

### Author: ![marcoswur](https://community.silverbullet.md/letter_avatar_proxy/v4/letter/m/a87d85/32.png) [@marcoswur](https://community.silverbullet.md/u/marcoswur)
#### Post date: [August 19, 2025, 1:14pm UTC](https://community.silverbullet.md/t/dostring-function-equivalent/3049/3 "2025-08-19T13:14:22Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![marcoswur](https://community.silverbullet.md/letter_avatar_proxy/v4/letter/m/a87d85/32.png) [@marcoswur](https://community.silverbullet.md/u/marcoswur)
#### Post date: [August 19, 2025, 1:23pm UTC](https://community.silverbullet.md/t/dostring-function-equivalent/3049/4 "2025-08-19T13:23:38Z")

</div>

I think I found the binary at [Release edge · silverbulletmd/silverbullet · GitHub](https://github.com/silverbulletmd/silverbullet/releases/tag/edge) : silverbullet-server-windows-x86\_64.zip  
I’ll try it…  
Thank you very much.

---

<div class="post-metadata">

### Author: ![marcoswur](https://community.silverbullet.md/letter_avatar_proxy/v4/letter/m/a87d85/32.png) [@marcoswur](https://community.silverbullet.md/u/marcoswur)
#### Post date: [August 19, 2025, 1:41pm UTC](https://community.silverbullet.md/t/dostring-function-equivalent/3049/5 "2025-08-19T13:41:17Z")

</div>

## I tested it here and it returned the error.

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

---

<div class="post-metadata">

### Author: ![zef](https://community.silverbullet.md/user_avatar/community.silverbullet.md/zef/32/7_2.png) [@zef](https://community.silverbullet.md/u/zef)
#### Post date: [August 19, 2025, 2:09pm UTC](https://community.silverbullet.md/t/dostring-function-equivalent/3049/6 "2025-08-19T14:09:44Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![marcoswur](https://community.silverbullet.md/letter_avatar_proxy/v4/letter/m/a87d85/32.png) [@marcoswur](https://community.silverbullet.md/u/marcoswur)
#### Post date: [August 19, 2025, 5:17pm UTC](https://community.silverbullet.md/t/dostring-function-equivalent/3049/7 "2025-08-19T17:17:33Z")

</div>

* * *

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.

```auto
{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 }`

---

<div class="post-metadata">

### Author: ![marcoswur](https://community.silverbullet.md/letter_avatar_proxy/v4/letter/m/a87d85/32.png) [@marcoswur](https://community.silverbullet.md/u/marcoswur)
#### Post date: [August 22, 2025, 12:28am UTC](https://community.silverbullet.md/t/dostring-function-equivalent/3049/8 "2025-08-22T00:28:55Z")

</div>

Regarding this issue, I found a related post…

> <https://github.com/silverbulletmd/silverbullet/pull/1474>
>
> This addresses the issue of mixing html and md widgets, as reported in this comm…unity post: https://community.silverbullet.md/t/mixing-html-and-md-widgets/2652
> 
> I’m not deeply familiar with the codebase, so I approached this by testing a few different solutions and settled on the one with the smallest footprint. It resolves the issue effectively without introducing major changes.
> 
> That said, the widget code might benefit from a broader refactor, which could be tackled in a separate pull request by someone more familiar with the internals.

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

> <https://github.com/silverbulletmd/silverbullet/pull/1476/commits/007edeec466527b3bde174f34a591c71444894ec>

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

```auto
${ 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.
