Markdown to insert views

Is there markdown method or api method (using <% %>) to use the newly minted inline view blocks (which are :kissing_heart:) ? I noticed that in the UI you can use {{}} to insert them but I don’t know what reference needs to go in between. The markdown exporter doesn’t seem

I have daily notes pages that are generated each day. I would really love to be able to automatically include a table/board view of my tasks and my daily calendar in each dialy notes entity.

3 Likes

I’ve got the same question…still see no reply here :slight_smile: Maybe this questions is answered elsewhere?

My use-case is to auto-generate weekly cadence (ie sprint) composed of different list of entities.

Basically, no.

Views cannot be ‘created’ on the fly.
You might want to have a look at this topic:

2 Likes

Never got time to follow-up. Thanks for reply @Chr1sG but what about inserting through markdown already existing view? I mean not manually by typing “<<” but through automations pre-fill some rich text field with some views?

For example I have some weekly cadence, or sprints if you want, and when new Sprint is created I want to (a) insert into Description already existent view with Sprint tasks…and ideally (b) to programmatically change filtering, so if I have board view filtered by Sprint #1 and I want to insert this view filtered by just created Sprint #2.

Again many thanks for your input! :pray:

1 Like

Unfortunately not. Markdown doesn’t currently support embedded views.
I assume the Tasks are linked to the Sprint, so you already have a relation view (and can add more variants if needed).
What are the reasons why you want a context filtered view of Tasks in the Description as well?

1 Like

Thanks for staying in touch! It’s not my main to need to have context filtered view but to generate Description through automation (markdown template) so it contains some particular (already existent) view, thanks!

1 Like

So do you want the automation to always populate the description with the same existing view every time it runs?

Yes, that’s right. So further I would customise filtering manually.

In that case, probably the easiest thing to do is to add the embedded view to a rich text field in an existing entity, and write a (temporary) script to get the rich text contents in html, e.g.

const fibery = context.getService('fibery');

for (const entity of args.currentEntities) {
    const entityWithExtraFields = await fibery.getEntityById(entity.type, entity.id, ['Description']);
    const content = await fibery.getDocumentContent(entityWithExtraFields['Description']['Secret'], 'html');
    console.log(content);
}

Then you can write an automation which will populate the rich text field of an entity on creation, using the content that you have just retrieved, e.g.

const fibery = context.getService('fibery');

for (const entity of args.currentEntities) {
    const entityWithExtraFields = await fibery.getEntityById(entity.type, entity.id, ['Description']);
    const content = '<div data-view-id="42328430-ea7a-11ed-a5aa-d3e002f0b1c6" contenteditable="false" data-node-height="400" data-node-width="900" data-node-page-width="true" data-node-full-width="false"></div>';
    await fibery.setDocumentContent(entityWithExtraFields['Description']['Secret'], content, 'html');
}
2 Likes