mirror of
https://github.com/matrix-org/matrix-spec
synced 2025-12-20 16:38:37 +01:00
23 lines
616 B
HTML
23 lines
616 B
HTML
{{/*
|
|
|
|
Renders an event example. Resolves `$ref`s, serializes as JSON, and ensures
|
|
that it can be included in HTML.
|
|
|
|
Parameters:
|
|
|
|
* `schema`: the schema of the example
|
|
* `name`: the name of the example
|
|
|
|
*/}}
|
|
|
|
{{ $path := delimit (slice "event-schemas/examples" .name) "/" }}
|
|
|
|
{{ $example_content := partial "json-schema/resolve-refs" (dict "schema" .schema "path" $path) }}
|
|
{{ $example_json := jsonify (dict "indent" " ") $example_content }}
|
|
{{ $example_json = replace $example_json "\\u003c" "<" }}
|
|
{{ $example_json = replace $example_json "\\u003e" ">" | safeHTML }}
|
|
|
|
```json
|
|
{{ $example_json }}
|
|
```
|