Open weyCC81 opened 1 week ago
Workaround for Request 1
plugins:
- encryptcontent:
encrypted_something:
encrypted_something:
#md-nav: [nav, class] # Hide's Toc
#md-tabs__link: [a, class] # Hide's Menü (Alternative)
#md-tabs: [nav, class] # Hide's Menü
#md-footer__inner: [nav, class] # Hide's footer
md-content__button: [a, class] # Hide's print button
Related to issue opened here.
Since the print-site
plugin absolutely wants to be the last plugin executed (cf: line 75 here) you must exclude the pages so that they are not visible as @unverbuggt said here.
However, it is possible for this print-site
plugin to perform custom actions on its side to specifically manage the EncryptContent plugin, since all encrypted pages are identified / identifiable by the other plugins.
For example, a way to automatically exclude all encrypted pages from print rendering (content & table of contents):
--- renderer.py 2024-11-17 12:40:00.430187474 +0100
+++ renderer_patched.py 2024-11-17 12:41:00.962667228 +0100
@@ -81,6 +81,11 @@
for item in items:
if item.is_page:
+ # Auto exclude protected pages from rendering (EncryptContent plugin)
+ if hasattr(item, 'encrypted'):
+ if item.encrypted == True:
+ self.plugin_config.get("exclude", []).append(item.file.src_path)
+
# Do not include page in print page if excluded
if exclude(item.file.src_path, excluded_pages):
logging.debug(f"Excluding page '{item.file.src_path}'")
I hope this helps you.
PS: The encrypted content of a page generated by encryptcontent plugin, is available in page.content
(instead of page.html
) in case you want to go further in compatibility.
Idea to add support for encryption
Plugin: encryptcontent Link: https://unverbuggt.github.io/mkdocs-encryptcontent-plugin/