Insert Bases in Note as a Code Block

Use case or problem

Currently Bases only supports embedding of a .base file using the common ![[some_base.base]] syntax, which means the base is stored separately from the note. However, it would be great to have the option to store the config of the base in the markdown file by using a specialized code block. Like this the base could be easily included in a template and moving the note or sharing it with someone would be easier since you don’t have to move or share also the embedded base file.

Ideally, this would also allow to use the metadata of the current note as a filter condition.
Consider you have a couple of notes that belong to one project and do have a key called “project” that stores the name of the project and want to include a BASES table listing all project files (and some additional metadata) in a the main note of the project. In the BASES code block you could then include a filter like:

filters:
and:
- project.contains(this.file.name)

Again this would add flexibility and make the base more generic so that if it iss included in a template would not need to be edited to match the current project.

Proposed solution

The bases config files are just simple YAML which could also be read from a markdown code block. For instance a simple BASES included as a code block could look like this:

```bases
views:
  - type: table
    name: Table
    filters:
      and:
        - project.contains("this.file.name")
    order:
      - file.name
      - tags
    sort: []

Actually …

Embed a base as a code block

Bases can also embedded directly into a note using a base code block and the bases syntax.

Thanks, for pointing out that this is already implemented.

1 Like

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