Meta-Bind to populate options from other page's body

What I’m trying to do

I’m trying to populate an inlineSelect from a bullet list in the body of another page. Very similar to the “Generating a list of Options from Front-matter” in the example file, except I want the options to be populated from another page’s body.

Just to make it more complicated, ideally it’s actually from a subsection of that page.

So in page A, we have the meta-bind JS block, something like:

frontmatter-something: Heading-Transport

---

 ```meta-bind-js-view
{options} as options
---
const heading_choice = context.bound.frontmatter-something
const options = ![[PageB#heading_choice]].map(x => `option(${x})`).join(", ");
const str = `\`INPUT[inlineSelect(${options}):selected]\``;
return engine.markdown.create(str); 
`INPUT[inlineList:options]`

Where the input list’s options are rending as: Planes, trains, automobiles

And then Page B would have:

##Heading-Transport:
 - planes
 - trains
 - automobiles

##Heading-Food:
- burgers
- fries
- coke

Things I have tried

I looked through all the Meta-Bind examples I could find. Closest thing I got was this example that binds a meta-data filed from another page..

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.