Added: | v2.5.0 |
---|
Generate screenshot first section of presentations by Playwright. Screenshots can use as OGP Image contents.
Note
This extension generates screenshots only when your running builder is revealjs
or dirrevealjs
.
Even if you run other builder with this in extensions, any screenshot are not generated.
This extension need Playwright and browser component.
pip install 'sphinx-revealjs[screenshot]'
playwright install
When addning extention into your conf.py
, this generates screenshots per pages.
You can set image path into :og:image:
field of sphinxext-opengraph in advance.
extensions = [
"sphinx_revealjs",
"sphinx_revealjs.ext.screenshot",
"sphinxext.opengraph",
]
:og:image: ./_images/ogp/sample-slide.png
Sample title
============
All Configuration names are prefixed revealjs_screenshot_
.
.. confval:: revealjs_screenshot_outdir :Type: ``str`` :Default: ``"_images/ogp"`` :Example: ``"_static/images"`` Output directory for generated screenshots. This must be releative path for outdir of Sphinx.
.. confval:: revealjs_screenshot_excludes :Type: ``List[str]`` :Default: ``[]`` (empty) :Example: ``["index"]`` List of docnames to exclude for target of screenshots. Valuese must be docname format that does not need extension of files.
After build all documents, launch headless-browser by Playwright.
Browser captures screenshots any document pages for these rule.
- Targets are generating files. If it runs incremental build and document is not changed, document is not target.
- If docname contains are :confval:`revealjs_screenshot_excludes`, document is not target.
When browser capture screenshots, this sets image size from Reveal
config (with and height).
This values are used viewport of presentation.
- If you want to change all sizes, you can set :confval:`revealjs_script_conf`.
- If you want to change per docs, you can set :rst:dir:`revealjs-slide` directive.
Currently, I reccomend using sphinxext-opengraph to add ogp metatags (it is useful). I delegate behavior about opengraph, and |THIS| does not have feature to generate ogp tags.