120 Commits

Author SHA1 Message Date
Adrian Vollmer
f6e6228bbf Reduce errors related to mime types
We don't need to know about the `ImportError` every time we guess a mime
type. Because an `ImportError` is also raised if `python-magic` is
installed but `libmagic1` is not present, we can handle this at the
beginning of the file.
2022-10-18 17:44:52 +02:00
Adrian Vollmer
31ff902098 Add fall back when guessing mime type
This fixes a bug that appears if the document is built on a system
without libmagic1. The python library python-magic uses it to guess the
mime type. We treat files with unknown mime type as `octet-stream`,
which causes them to be downloaded rather than displayed in the main
iframe. This results in lots of popups when opening the resulting HTML
file in a browser.

In this commit we add a fallback to the built-in library `mimetypes`
which gueses the mime type from the filename alone. This should work in
most cases but could still fail.

Close #2.
2022-10-18 17:30:40 +02:00
Adrian Vollmer
3958492feb Add revert flag 2022-10-18 17:24:47 +02:00
Adrian Vollmer
815b6ac11a Remove redundant source url pragma 2022-10-18 14:03:56 +02:00
Adrian Vollmer
384f76120c Add sphinx-tabs to test 2022-10-17 18:07:25 +02:00
Adrian Vollmer
c24f30f5ec Fix error with about:srcdoc links; add extra check 2022-10-16 19:18:24 +02:00
Adrian Vollmer
0c4bbe69a3 Update README 2022-10-12 18:28:00 +02:00
Adrian Vollmer
7764198e91 Fix README 2022-10-12 18:15:44 +02:00
Adrian Vollmer
068f2db12c Fix links with leading slash 2022-10-12 15:27:51 +02:00
Adrian Vollmer
fadbb72e67 Add support for append-pre/post 2022-10-12 14:48:58 +02:00
Adrian Vollmer
25fb93219c Rename some files; fix sourceURL pragmas 2022-10-12 14:41:57 +02:00
Adrian Vollmer
b563da585e Improve docstring 2022-10-12 13:43:24 +02:00
Adrian Vollmer
e05de76bad Improve CSS embedding 2022-10-12 13:42:05 +02:00
Adrian Vollmer
d5b30f9f52 Open external links in new tab 2022-10-12 12:54:03 +02:00
Adrian Vollmer
74fc46e1d9 Gracefully handle missing files 2022-10-11 23:09:48 +02:00
Adrian Vollmer
7a91f36b2a Include demos in README 2022-10-11 19:05:01 +02:00
Adrian Vollmer
37fa79a503 Update README 2022-10-11 18:55:23 +02:00
Adrian Vollmer
871729569d Add zundler_root_doc config value 2022-10-11 18:29:11 +02:00
Adrian Vollmer
b8753bb03c Improve version dependent code 2022-10-11 18:28:58 +02:00
Adrian Vollmer
430e342e2d Update gitignore 2022-10-11 17:55:35 +02:00
Adrian Vollmer
83d3010207 Update inline LICENSE 2022-10-11 14:34:52 +02:00
Adrian Vollmer
1ec2439350 Add new LICENSE 2022-10-11 14:33:59 +02:00
Adrian Vollmer
4aa35afb16 Remove LICENSE 2022-10-11 14:30:06 +02:00
Adrian Vollmer
e3f08cc2ee Update README 2022-10-11 14:24:40 +02:00
Adrian Vollmer
f652131f11 Change on_scroll_to_anchor so no history entry is added 2022-10-11 14:20:09 +02:00
Adrian Vollmer
d4978d55de Some refactoring; also fix anchor links 2022-10-11 14:08:20 +02:00
Adrian Vollmer
2bdf43629d Monkey patch jQuery 2022-10-10 19:22:42 +02:00
Adrian Vollmer
5359ba8256 Add warning to README 2022-10-10 19:11:41 +02:00
Adrian Vollmer
eb0e4110a8 Fix anchor links 2022-10-10 17:41:55 +02:00
Adrian Vollmer
351582e055 Add more source pragmas 2022-10-10 17:41:41 +02:00
Adrian Vollmer
649324d576 Use main() function in inject.js 2022-10-10 17:41:22 +02:00
Adrian Vollmer
c0951bc3c0 Remove debug statement 2022-10-10 17:41:06 +02:00
Adrian Vollmer
f7701b429b Add source pragmas to init.js and inject.js 2022-10-10 17:40:47 +02:00
Adrian Vollmer
9a4f8207a6 Add test case 2022-10-10 16:00:23 +02:00
Adrian Vollmer
150a7f2c76 Improve logging 2022-10-10 15:09:07 +02:00
Adrian Vollmer
ad4f3c838c Properly handle mime type in embed_img 2022-10-10 14:48:11 +02:00
Adrian Vollmer
4088f251e3 Compatibility for Sphinx<=4 and Sphinx>4 2022-10-09 18:07:01 +02:00
Adrian Vollmer
996adba3a0 Update gitignore 2022-10-09 18:06:43 +02:00
Adrian Vollmer
7b5d48c949 Avoid deprecated Builder interface 2022-10-09 17:42:21 +02:00
Adrian Vollmer
c60bee22b2 Handle non-existing favicons 2022-10-09 17:42:21 +02:00
Adrian Vollmer
9840d92932 Make 'file not found' message a warning 2022-10-09 17:42:19 +02:00
Adrian Vollmer
7a891bb14d Include copyright notice 2022-10-09 13:04:56 +02:00
Adrian Vollmer
cebe021f6e Update README 2022-10-09 12:40:05 +02:00
Adrian Vollmer
2ec9ca7749 Prevent error if favicon not found 2022-10-09 12:39:56 +02:00
Adrian Vollmer
3cbcb667db Handle clicks on non-html files 2022-10-09 12:39:36 +02:00
Adrian Vollmer
223b88639f Use better mime type guessing 2022-10-09 12:15:54 +02:00
Adrian Vollmer
0147b332d5 Update README about jupyter-book 2022-10-09 10:52:24 +02:00
Adrian Vollmer
851532a125 Include more information in case of JS error 2022-10-09 10:51:53 +02:00
Adrian Vollmer
369a9fd3cb Handle non-existing files gracefully 2022-10-09 10:51:32 +02:00
Adrian Vollmer
1924eb07a9 Implement Sphinx extension 2022-10-05 17:11:12 +02:00