@@ -261,7 +261,7 @@ Subscribing
261
261
262
262
Subscribing to updates in JavaScript from a Twig template is straightforward:
263
263
264
- .. code-block :: twig
264
+ .. code-block :: html+ twig
265
265
266
266
<script>
267
267
const eventSource = new EventSource("{{ mercure('https://example.com/books/1')|escape('js') }}");
@@ -278,7 +278,7 @@ parameters corresponding to the topics passed as first argument.
278
278
If you want to access to this URL from an external JavaScript file, generate the
279
279
URL in a dedicated HTML element:
280
280
281
- .. code-block :: twig
281
+ .. code-block :: html+ twig
282
282
283
283
<script type="application/json" id="mercure-url">
284
284
{{ mercure('https://example.com/books/1')|json_encode(constant('JSON_UNESCAPED_SLASHES') b-or constant('JSON_HEX_TAG'))|raw }}
@@ -296,7 +296,7 @@ Mercure also allows subscribing to several topics,
296
296
and to use URI Templates or the special value ``* `` (matched by all topics)
297
297
as patterns:
298
298
299
- .. code-block :: twig
299
+ .. code-block :: html+ twig
300
300
301
301
<script>
302
302
{# Subscribe to updates of several Book resources and to all Review resources matching the given pattern #}
@@ -427,7 +427,7 @@ passed by the browsers to the Mercure hub if the ``withCredentials`` attribute
427
427
of the ``EventSource `` class is set to ``true ``. Then, the Hub verifies the
428
428
validity of the provided JWT, and extract the topic selectors from it.
429
429
430
- .. code-block :: twig
430
+ .. code-block :: html+ twig
431
431
432
432
<script>
433
433
const eventSource = new EventSource("{{ mercure('https://example.com/books/1', { subscribe: 'https://example.com/books/1' })|escape('js') }}", {
@@ -455,7 +455,7 @@ is the way to go.
455
455
The native implementation of EventSource doesn't allow specifying headers.
456
456
For example, authorization using a Bearer token. In order to achieve that, use `a polyfill `_
457
457
458
- .. code-block :: twig
458
+ .. code-block :: html+ twig
459
459
460
460
<script>
461
461
const es = new EventSourcePolyfill("{{ mercure('https://example.com/books/1') }}", {
0 commit comments