diff options
author | Martin Fischer <martin@push-f.com> | 2021-12-26 09:09:20 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2021-12-26 21:17:31 +0100 |
commit | 123e04b2f2f1f38066ddc048605d31f9abd4dfd1 (patch) | |
tree | 16180370bf61f89e380e09f2db2d980119135a77 /doc/_templates | |
parent | 56878a23f698a0fa5c2f884da6ed1f85f2a0feed (diff) | |
download | pygments-git-123e04b2f2f1f38066ddc048605d31f9abd4dfd1.tar.gz |
demo: stop blocking main thread by using web worker
Previously highlighting a large file with a complex lexer just hung the
whole browser tab (meaning you couldn't interact with the page anymore).
This commit outsources the higlighting to another thread by using a web
worker. Depending on web workers shouldn't reduce browser compatability
since the page already depends on WASM (and according to caniuse.com any
browser that supports WASM also supports web workers).
Diffstat (limited to 'doc/_templates')
-rw-r--r-- | doc/_templates/demo.html | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/doc/_templates/demo.html b/doc/_templates/demo.html index 8e967f23..0bbf4edd 100644 --- a/doc/_templates/demo.html +++ b/doc/_templates/demo.html @@ -4,8 +4,6 @@ {% block extrahead %} {{ super() }} <link rel="stylesheet" type="text/css" href="{{ pathto("_static/demo.css", 1) }}"> -<script type="text/javascript">var languagePluginUrl = "{{ pathto("_static/pyodide/", 1) }}";</script> -<script type="text/javascript" src="{{ pathto("_static/pyodide/pyodide.js", 1) }}"></script> {% endblock %} {% block htmltitle %}<title>Demo{{ titlesuffix }}</title>{% endblock %} @@ -52,7 +50,7 @@ <div id="hlcode"></div> -<div id="hlcodedl" style="display: none"> +<div id="hlcodedl" hidden> <input type="text" id="copy_field" style="opacity: 0"> <input type="button" value="Download" onclick="download_code()"> |