Closed wnm3 closed 4 years ago
Thanks very much. I appreciate your work. I've been working on filtering web content to Markdown and use your extension all the time. I do run into issues with tables with too wide columns or as the first part of the .md file but otherwise it does a great job.
Is it not possible for the extension to automatically and silently handle the case of rich HTML documents being served on .md
URLS?
It seems that (at least on Chrome), genuine raw markdown will be wrapped in a single <pre>
but otherwise left alone. A possible implementation would be to test if the page contains, say, more than 5 Element
nodes within the <body>
; if it does, assume that the document is rich and abort the process; otherwise, continue with the normal behaviour.
I could look into making an MR for this, if you'd like.
Sounds like a possible implementation although I'm not entirely sure you want to do that all the time. This extension was also tested for performance and every little thing you add in the way of the rendering adds up. Then this have to work for Firefox and Edge.
I don't think it would be that bad on performance. What springs to mind is just waiting for DOMContentLoaded and then doing a BFS that terminates once it has seen 5 nodes. This will add a delay to rendering in order to run the search, but it should be a trivial amount of time since it's only looking for 5 nodes. It should also be highly portable; the key requirements are DOMContentLoaded and .childNodes, which respectively have 99.18% and 96.34% global coverage.
Anyway, we can talk about it further once I make an MR; that way, we won't be talking in the abstract about things that have yet to exist.
If you access this github page: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md you'll see it won't render and the console reports an error below, but if I disable your extension the page loads fine:
3.0.3.md:1 Refused to load the font 'data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAAAAoAAQAAT1MvMgAAAyQAAABJAAAAYFYEU3RjbWFwAAADcAAAAEUAAACAAJThvmN2dCAAAATkAAAABAAAAAQAAAAAZnBnbQAAA7gAAACyAAABCUM+8IhnYXNwAAAGTAAAABAAAAAQABoAI2dseWYAAAFsAAABPAAAAZwcEq9taGVhZAAAAsgAAAA0AAAANgh4a91oaGVhAAADCAAAABoAAAAkCA8DRGhtdHgAAAL8AAAADAAAAAwGAACfbG9jYQAAAsAAAAAIAAAACABiATBtYXhwAAACqAAAABgAAAAgAA8ASm5hbWUAAAToAAABQgAAAlXu73sOcG9zdAAABiwAAAAeAAAAME3QpOBwcmVwAAAEbAAAAHY...JBhagk7HQzKxca2sJCE1hDt4QF+9JOS0nbaaYDCQfwCJ7Au3AHj+LO13FMmm6cl7785vven0kBjHCBhfpYuNa5Ph1c0e2Xu3jEvWG7UdPDLZ4N92nOm+EBXuAbHmIMSRMs+4aUEd4Nd3CHD8NdvOLTsA2GL8M9PODbcL+hD7C1xoaHeLJSEao0FEW14ckxC+TU8TxvsY6X0eLPmRhry2WVioLpkrbp84LLQPGI7c6sOiUzpWIWS5GzlSgUzzLBSikOPFTOXqly7rqx0Z1Q5BAIoZBSFihQYQOOBEdkCOgXTOHA07HAGjGWiIjaPZNW13/+lm6S9FT7rLHFJ6fQbkATOG1j2OFMucKJJsxIVfQORl+9Jyda6Sl1dUYhSCm1dyClfoeDve4qMYdLEbfqHf3O/AdDumsjAAB42mNgYoAAZQYjBmyAGYQZmdhL8zLdDEydARfoAqIAAAABAAMABwAKABMAB///AA8AAQAAAAAAAAAAAAAAAAABAAAAAA==' because it violates the following Content Security Policy directive: "font-src github.githubassets.com".