QWebChannel + QWebEngineView to render markdown (example in qtcreator) has error notes printed to stdout...
-

[14700:17216:0524/231205.700:WARNING:http_cache_transaction.cc(1189)] Unable to open or create cache entry [14700:17216:0524/231205.700:WARNING:http_cache_transaction.cc(1189)] Unable to open or create cache entry [14700:17216:0524/231205.749:WARNING:http_cache_transaction.cc(1189)] Unable to open or create cache entry [14700:17216:0524/231205.749:WARNING:http_cache_transaction.cc(1189)] Unable to open or create cache entry
The index.html that I am rendering (includes KaTeX for math typesetting, and disables markdown):
<!doctype html> <html lang="en"> <meta charset="utf-8"> <head> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css" integrity="sha384-R4558gYOUz8mP9YWpZJjofhk+zx0AS11p36HnD2ZKj/6JR5z27gSSULCNHIRReVs" crossorigin="anonymous"> <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js" integrity="sha384-z1fJDqw8ZApjGO3/unPWUPsIymfsJmyrDVWC8Tv/a1HeOtGmkwNd/7xUS0Xcnvsx" crossorigin="anonymous"></script> <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/auto-render.min.js" integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"></script> <!-- <link rel="stylesheet" type="text/css" href="3rdparty/markdown.css"> <script src="3rdparty/marked.js"></script> --> <script src="qrc:/qtwebchannel/qwebchannel.js"></script> <style type="text/css"> body { overflow:hidden; } </style> </head> <body> <div id="placeholder"></div> <script> 'use strict'; document.addEventListener("DOMContentLoaded", function() { var placeholder = document.getElementById('placeholder'); var renderMath = function() { renderMathInElement(document.body, { // customised options // • auto-render specific keys, e.g.: delimiters: [ {left: '$$', right: '$$', display: true}, {left: '$', right: '$', display: false}, {left: '\\(', right: '\\)', display: false}, {left: '\\[', right: '\\]', display: true} ], // • rendering keys, e.g.: throwOnError : false }); } var updateText = function(text) { placeholder.innerHTML = text; // marked(text); renderMath(); } new QWebChannel(qt.webChannelTransport, function(channel) { var content = channel.objects.content; updateText(content.text); content.textChanged.connect(updateText); } ); }); </script> </body> </html>
So I took the canonical markdown example as found in Qt Creator examples, and I converted it to instead render using KaTeX's javascript lib as imported from remote CDN in the index.html.
I get the above errors. I think since it does take about 20 seconds before the QWebEngineView actually displays the rendering to the screen (checking for loadFinished signal doesn't work btw), there must be something going wrong on the Javascript side that might be causing the delay. I think the errors get pooped out just as it finally loads visually.
Good news is the program is useable after the initial 20second wait for the hangup. Can you understand what's happening just from your experience? Is there anything I can check or disable somewhere in order to not emit such errors, and even bypass whatever it's getting caught up on?
-
Switching to a local copy of KaTeX and linking to index.html using "qrc:/KaTeX/katex.min.css" + 2 others and it seems to be working without running into those errors. A local copy is also better so that there's no dependence upon the users' internet connectivity.
-
Actually found out what's taking it so long to render at the start (independently of the above mentioned errors) is that this will occur in Debug mode, but switching QtCreator to Release and the app loads instantaneously and also gets past the first render in usual speed that follows.
Here's a video of it working, with auto-indexing: