Gitlab snippets don't always render on GitBook published pages ["Failed to execute 'write' on 'Document']

I’m writing a technical article using GitBook to publish into GitLab Pages (forked from the sample GitBook project) but I’ve found that snippets only appear sporadically.

When they don’t show, there are messages like this in the console:

Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.

Here’s an example page. The embed script may or may not run - multiple refreshes can cause different results, and I’ve noticed it fairly consistently doesn’t appear when using a mobile Chrome browser (though it does appear when requesting the desktop version in the same browser)

Is there an alternate way to embed snippets into a GitBook page without using the script tags?

Edit: I’ve found you can use the include-codeblock plugin to include a syntax highlighted source file from the git repo, which is mostly-ok, but it looses much of the richness of using the snippet embedding