Skip to content

Argument Presets

Most of the time, you probably won't need to create elements manually - you can simply use presets. Element presets are invoked like an element, but prefixed with ! instead of :. A number of default presets are pre-defined (and styled by the included themes). They are:

  • !l or !label - :th {-1 .infobox-label}
  • !d or !data - :td {-1 .infobox-data}
  • !h or !header - :th {--1 .infobox-header}
  • !i or !image - :td {--1 .infobox-image}
  • !t or !title - :ca {.infobox-title}

You may define your own presets in \.obsidian\plugins\obsidian-infobox\presets.json (currently requires reload after editing). This defines two sets of presets: boxTypes and elements. The defaults are not present in the JSON, but may be overwritten by it, so any plugin updates will not overwrite your presets.

Elements are <string, object> pairs. The string is the preset id invoked by prefixing that string with !. The object contains properties that will be assigned to the element. These are:

  • element: string
  • aliases: string[]
  • classes: string[]
  • attr: { [string]: value }

Here is an example of a presets.json that defines a single element:

{
  "elements": {
    "z" : {
        "aliases" : ["zoo"],
        "element" : "td",
        "classes" : ["zoo"],
        "attr" : { "test" : "foo" }
      }
  }
}
With the above configuration, invoking !z or !zoo will create a table cell with the class zoo and the attribute test set to foo. In this way, you may define any amount of presets for ease of use.