Section transclusion, custom attributes and tags

I’m trying to transclude a section based on a tag and a custom attribute.

The is that the square brackets seem to cause issues with parsing the transclusion expression.

  1. Am I approaching transclusion of particular sections the right way?
  2. Am I using custom attributes and tags for what they are made for?

Minimal problem:

Section to transclude

## Meeting [with: Bob]
- Lorem
- Ipsum

## Other Section
- a
- b
- c

Transclusion

[[Sandbox]]
![[Sandbox#Meeting [with: Bob]]]

Result:

image

The “c]” seems to be the last character of the transcluded page (instead of section) and the closing square bracket from the transclusion syntax.

Actual problem

I’m trying to automatically transclude sections for one-one-ones based on a query:

Template

#template
## [[page]]
![[{{page}}#{{name}}]]

Query

one-on-ones
where person = "Bob" limit 3
render each [[Sandbox/Transclusion]]

Section to transclude

## Meeting [with: Bob] #one-on-ones
- Lorem
- Ipsum

## Other Section
- a
- b
- c

Result

The result is pretty much the same as in the minimal example:
image

Seems like transcluding the last section is problematic as well (stays empty), but a separate issue. :smiley:

Edit: and apparently already reported: h2 transclusion does not render if it's the last section of the page · Issue #1086 · silverbulletmd/silverbullet · GitHub

I tried working around the parsing issue by using this in the template:

{{readPage(page + "#" + name)}}

However, this still doesn’t work, because of the tag in the name:

# Test [with: Bob] #one-on-ones
                    ^-- this seems problematic

Final work around is creating the title with an alternative tagging syntax:

# Test [with: Bob] [tag: one-on-ones]

Now it renders nicely!
image

Based on template:

## [[{{page}}]]
Name: {{name}}
Section:
{{readPage(page + "#" + name)}}