Transclusion of dynamic content is strange

I have a page with leaflet code block, which is interpreted by this plug into leaflet iframe (map with additional markers).

If I try to transclude this page into another, leaflet code block is just shown as a codeblock and is not interpreted. Is this an expected behaviour?
If not, and if this is coming from the plug, maybe somebody could point to potential cause?

Also, widgets, for example buttons (created on original page as ${widgets.button("Button", myfunc)}) or embed.youtube blocks, seem to be incorrectly rendered on transclusion too.
This is how they are show on the final page:

html _isWidget
{} true

Read more here about similar/same issue:

Like @Zef said, this is a known issue, and it would be pretty hard to fix, so don’t expect a fix anytime soon.

Hmm, I guess I can see how transclusion and table rendering might be closely related, once you pointed that out. But it didn’t pop into my mind before =(
Thanks!

Anything regarding leaflet part?
Or is it also the same problem, and I’m just missing the parallels again?

I don’t know much about that specific plug, or plugs in general. If the plug iframe is rendered as a html or as a widget, then that’s definitely the same issue. Depending on how the plug was made. I tried to install the plug on 2.1.9 edge, and tried the two examples form the readme but with no success at all. It says invalid config and i cant find Any documentation on how to Config it :man_shrugging:

Just paste this (but without \), and it should render a map:

```leaflet
  lat: 50.0
  lng: 20.0
  zoom: 10
``\`

This did the trick on displaying the map inside the document. But no luck with the transclusion.

I did some tests and I think the issue although it seems similar, but its not quite the same with the one I mentioned about (_isWodget=true). But I came to the conclusion that transclusions don’t render anything beside plain markdown. I don’t think it’s possible to transclude any page content which have widgets, iframes, or any html snippets inside and to render them properly.

But what’s your use case of transluding a page with leaflet maps? Maybe we can have a workaround , for example storing the GPS coordinates in the frontmatter, then creating a function to get the coordinates from
The frontmatter to display the map in your page with something like ${showMapFrom(page)}, of course depending on your use case this could be feasible or not.

for example storing the GPS coordinates in the frontmatter

That is exactly what I’m doing.
I store list of venues with the coordinates in frontmatter.
But then, I created a body of leaflet config directly in the page, and added a button with custom function to update list of markers. (That’s why I mentioned both leaflet and button in the original question)
I do it this way, because I couldn’t find a working approach to giving dynamic list of markers to leaflet (while preserving plug in it’s original state)

If you have ideas how dynamic content can be put inside “code block” of leaflet, please share

how complicated/much info is on the page you would like to transclude (is that the right word. lol) ?

if it’s just a button and a leaflet widget, you could workaround this by recreating the leaflet-widget and button locally(from the frontmatter date) simply with a with a function which gets the data and adds only the markdown content as a transclusion:

Scenario 1
your page you want to transclude is built like:

---
lat: 50
lon: 20
everything: "else"
---

[Button]

[LEAFLET WIDGET]
 
Other contents of the page

so the space lua function:

let’s say you want to transclude this page in another page:

${fake_transclude(page)]

the function would do following steps:

  • get the page contents, separates the frontmatter and strips the problematic (interactive elements) away from the contents.
  • Then it get the lat and lon from that file
  • rebuilds the button locally on your page to execute your desired command
  • rebuilds the leaflet widget in your page as markdown
  • adds the other markdown contents from your page.

well at least in theory that is how it could work, if i understood the usecase correctly.

No idea. But let’s use it - inventing words is fun)


How I use is now:
I have page structure like this

  • Venues
    • venue 1
    • venue 2

Each venue page has frontamtter with coordinates, and other fileds, and content of the page is feedback/notes/etc. No map on this page.

Then, I have an aggregate map of the venues on the page Venues with format like this:

  lat: 50.0
  lng: 20.0
  zoom: 10
  markers:  #markerplaceholder
  - lat: 50.01
    lng: 20.01
    title: venue 1
  - lat: 50.02
    lng: 20.02
    title: venue 2

And also a button to update it: button queries venus from subfolder and update markers on current (for button) page based on placeholder mark i added.

Then also I have the same aggregate map and same button on another page Plans.

To avoid copying, I tried to include segment of the page Venues to Plans.


${fake_transclude(page)]

As far as I can tell (and please correct me if I’m wrong here), if I include content with such^ call, leaflet (or any other) plugin will not process it.

I guess, in theory I can write a function, that would query venues for markers, and then itself add leaflet iframe, sidestepping plugin.
But I’m not yet very familiar with how to mix JS and Lua. And I would still need plug for other places where it is used “manually”.