Template Language Reference
Reference used in the user-configurable templates in WarmHub
Last updated
Reference used in the user-configurable templates in WarmHub
Last updated
The template language available in the editor is based on Markdown. It is further extended using Nuxt Markdown Components (MDC). Documentation for Nuxt MDC can be found at this link:
There are a variety of components available to the template author which enhance the presentation of data past what is available in vanilla Markdown. References to these components are done through the Nuxt MDC syntax.
Certain shorthand names to components are also available. Shorthand names are a quick way to create components with some defaults automatically applied.
Some components also have alternate keys. They function as aliases, and you can use them in both the full form and shorthand form, if applicable.
Displays a single property from a object.
Property
Description
Required
data
A dot-notated reference to a particular field available in the instance data
Yes
label
Any string
No
format
A formatter object [formatter](any arguments)
No
Shorthand: :property [instance.data]
Full example
Shorthand example
The data of the related list is entered in two ways. Using one and only one way is required:
data
: A dot-notated reference to a record of strings and objects in the instance data
query
: A string which can take on the following forms:
Instance with explore link:
/api/<org>/<repo>/<typeName>/<id>/explore + (optional) /r/<revision>
Instance by type:
/api/<org>/<repo>/<typeName>
Instance type with search query:
/api/<org>/<repo>/<typeName>?query=querystring
See appendix about search query for more information
In the query property in the related list component, there exists two macros which can be utilized anywhere in that property for ease of referencing the current type:
$id
resolves to the identifier for the current instance
$wid
resolves to the full http://repo.warmhub.com/...
link for the instance
The related list can be further configured using the following optional properties:
Property
Description
Required
label
Any string
No
selectedColumns
A list of the keys of the columns to display (left to right)
No
headers
A list of strings to use as column headers (left to right)
No
format
A key:value list of formatters, in the following form: [columnName]:[formatter]|[columnName]:[formatter]…
No
A list of properties.
Property
Description
Required
data
A dot-notated reference to an array of displayable items
Yes
label
Any string
No
Shorthand: :list [instance.data]
A wref takes on the form of http://repo.warmhub.com/<org>/<repo>/<type>/<id>
+ (optional) /r/<revision>
.
Property
Description
Required
data
A dot-notated reference to an array of displayable items
Yes
label
Any string
No
Acceptable keys: summary
, instance-summary
Shorthand: :[key] wref
Similar to the related list object, you can supply data for the instance summary list in the following manners:
data
: A dot-notated reference to a list of wref strings
query
: A string which can take on the following forms:
Instance by type:
/api/<org>/<repo>/<typeName>
Instance type with search query:
/api/<org>/<repo>/<typeName>?query=querystring
See appendix about search query for more information
Instance by root type:
/api/<org>/<repo>/dataByType/<rootType>
dataByType
is case sensitive
The available root types are: articles
, sources
, evidence
, claims
Shows the summary template of another repository.
Property
Description
Required
org
A string which is the name of an org
Yes
repo
A string which is the name of a repo
Yes
label
Any string. Defaults to {org} - {repo}
No
Acceptable keys: repo
, repo-summary
Shorthand: :[key] org/repo
Embeds external content into your template via URL.
Property
Description
Required
src
The link to the item to embed
Yes
height
The desired height of the embed (e.g. 500px)
No
Acceptable keys: embed
, frame
, iframe
, embed-item
Shorthand: :[key] src
Filtering is provided by query string (?filter=
) on the API or web routes which return the data by instance type. It allows you to query by certain values in the data. The query string takes on the form of:
field
: operator
: value
field
is a dot-notated reference to the field of the object on which you are filtering
operator
is one of the following:
eq
: equals
gt
: greater than
gte
: greater than or equal to
lt
: less than
lte
less than or equal to
value
is the desired value you would like to filter to
The value will be interpreted as the same type (either text, number, or boolean) as the type of the particular field
In related lists, numbers in relevant columns are automatically formatted to 5 digits of precision, and automatically converted to scientific notation where relevant.
bold
: Makes the text bold
italic
: Makes the text italicized
number(precision: integer = 5)
: Formats a number to a certain precision, using scientific notation if possible
number() on 12345 = 12345
number() on 123456 = 1.2346e+5
number(6) on 123456 = 123456
round(decimals: integer = 0)
: Rounds a number to a certain number of decimal places. Equivalent to TypeScript Number.toFixed(decimals)
round() on 12345 = 12345
round(2) on 12345 = 12345.00
round() on 0.016 = 0
round(2) on 0.016 = 0.02
formatBytes(decimals: integer = 2)
: Formats a number to a power-of-2 quantity of bytes specified in IEC 80000-13
formatBytes() on 1234 = 1.21 KiB
formatBytes(3) on 1234 = 1.205 KiB
formatBytes() on 1048575 = 1024 KiB (2^10 - 1 bytes)
formatBytes() on 1048577 = 1 MiB