matrix-spec/layouts/partials/events/example.html

23 lines
616 B
HTML
Raw Normal View History

2022-10-26 22:33:41 +02:00
{{/*
Renders an event example. Resolves `$ref`s, serializes as JSON, and ensures
2022-10-26 22:33:41 +02:00
that it can be included in HTML.
Parameters:
* `schema`: the schema of the example
* `name`: the name of the example
2022-10-26 22:33:41 +02:00
*/}}
{{ $path := delimit (slice "event-schemas/examples" .name) "/" }}
{{ $example_content := partial "json-schema/resolve-refs" (dict "schema" .schema "path" $path) }}
2022-10-12 21:49:21 +02:00
{{ $example_json := jsonify (dict "indent" " ") $example_content }}
{{ $example_json = replace $example_json "\\u003c" "<" }}
{{ $example_json = replace $example_json "\\u003e" ">" | safeHTML }}
```json
{{ $example_json }}
```