hyogen-md

0.10.0

Methods

Method calls in {{ }} and @hg expressions are restricted to a small whitelist. Arbitrary chaining (.map, .trim, etc.) is not allowed.

toLocaleString

The only permitted method is .toLocaleString(...). Arguments follow JavaScript conventions — the library does not validate them.

<!--
@hg
const population = 2825000
@endhg
-->

Population: {{ population.toLocaleString('en-US') }}

Output:

Population: 2,825,000

Works on component props too:

{{ population.toLocaleString('ja-JP') }}

Template literals

.toLocaleString is also allowed inside `${…}` in @hg blocks:

<!--
@hg
const n = 1000
const label = `count: ${n.toLocaleString()}`
@endhg
-->

Function calls

The only callable functions are registered components (component … as name):

{{ cityItem({ city: "Osaka", population: 2825000 }) }}

There are no built-in functions in v0.10.0.

Not allowed

{{ items.map(x => x.name) }}   <!-- parse_error -->
{{ text.trim() }}              <!-- parse_error -->
{{ Math.max(a, b) }}           <!-- parse_error -->

Use @hg declarations or component templates to prepare values instead.