A sphinx extension for peeking at internal references.
Project description
sphinx-peek
Sphinx extension for peeking at references
In Development!
The extension adds a small icon next to select references, that can be clicked to peek at the target of the reference.
- Resizable modal window
- Anchored to the reference during scrolling and window resizing
- Nested reference peeking supported
See documentation at https://sphinx-peek.readthedocs.io/
Development notes
Yet another sphinx-extension for previewing links!
Aims:
- As simple as possible
- All CSS and JavaScript is bundled with the extension
There is already:
-
This works by adding specific HTML classes to certain internal and intersphinx references, and then using JavaScript to show a preview window on mouseover, which is populated with content obtained by making an API call to the ReadTheDocs server.
The key drawback of this approach is that it only works when the documentation is being served by ReadTheDocs. Also intersphinx previews only work when the target documentation is also being served by ReadTheDocs.
-
This works by creating all preview content in advance, during the build process, and uses tippy.js to show the preview window on mouseover.
A drawback is that it can be difficult to make the preview content look good, and integrate with the rest of the documentation theme.
-
This works by using Javascript to add iframe windows for previewing.
Changes to sphinx-preview
This extension adapts the approach of sphinx-preview
, but makes some changes including:
- Replaces the use of JQuery with vanilla JavaScript
- Always uses clickable icons to show the preview window, rather than mouseover hover (I feel this gives the user more control, and understanding of which links are preview-able)
- Fixes some bugs with the scroll-to-anchor behaviour, and preview window positioning
- Adds anchoring of the preview window to the reference, during scrolling and window resizing
- For development purposes, also adds JSDoc type annotations to the JavaScript code and uses pre-commit hooks to check the formatting and type safety of the code.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sphinx_peek-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4227328e49052047f7404d08354627eb65dea26393839325e34b0a75fdb47c56 |
|
MD5 | a7d466212db0bed12c7c8177bd320574 |
|
BLAKE2b-256 | ec82e3a5b6a11060586ecfd91789a0fbce0dc1b35c249ffa8d0ba748c86897ee |