unverbuggt / mkdocs-encryptcontent-plugin

A MkDocs plugin that encrypt/decrypt markdown content with AES
https://unverbuggt.github.io/mkdocs-encryptcontent-plugin/
MIT License
123 stars 15 forks source link

Encrypted content not showing after decryption (using mixed markdown page) #60

Closed anxou closed 8 months ago

anxou commented 8 months ago

Hello, I am trying to encrypt just parts of a markdown page and found the "Mix encrypted and normal content" section in the documentation. I copied and tested the example from the documentation. The encryption works, but as soon as I enter the password and decrypt the content, the form disappears but the teaser is still visible and the protected content is not displayed.

I added the "pymdownx.blocks.html" extension and created a markdown page like in the example of the documentation. Am I missing something in my configuration?

plugin configuration (mkdocs.yml):

plugins:
  - search
  - encryptcontent:
      password_file: 'passwords.yml'
      title_prefix: ''
      summary: ''
      placeholder: 'Password'
      placeholder_user: User
      password_button_text: 'ENTER'
      decryption_failure_message: 'Wrong user name or password.'
      encryption_info_message: 'Legitimation required.'
      password_button: True
      input_class: 'md-input'
      button_class: 'md-button md-button--primary'
      hljs: False
      arithmatex: False
      mermaid2: False
      remember_keys: false # keys from keystore will temporarily saved to sessionStorage
      remember_password: false # the entered credentials are not saved
      remember_prefix: encryptcontent_plugin_ # use different prefixes if other sites are running on the same domain
      search_index: 'dynamically' # dynamically encrypt mkdocs search index 
      webcrypto: true # use browsers webcrypto support

markdown_extensions:
  - pymdownx.blocks.html

The Markdown page looks as follows:

title: This page mixes encrypted and normal content
level: classified
inject_id: protected
delete_id: teaser

/// html | div#teaser
## Teaser

You won't believe which secrets this page will unveil.
Find out more after you enter the correct password...
///

/// html | div#protected
## Secret

Well, the princess is another castle.
///

## Unprotected Content
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

Before decryption: image

After decryption:

anxou commented 8 months ago

Just found the issue... I was missing the part with "encrypted_something" in my configuration.