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

Incrypt just one markdow file with password on ENV #64

Closed alandrebraga closed 6 months ago

alandrebraga commented 7 months ago

Hello! I'm new to this lib and i have this config on my files

plugins:

Suposse that my user1 ENV TESTE password is test

How can i encrypt the file?


password: TESTE

I test with this metatag but dont work

unverbuggt commented 7 months ago

Hi,

the minimal mkdocs.yml is as follows:

site_name: test

plugins:
  - search: {}
  - encryptcontent:
      password_inventory:
        secret:
          user1: !ENV TESTE

and you start your file_to_be_encrypted with the meta tag level: secret to refer to the level in the inventory, not password: (otherwise you'll set the password to "TESTE").

Before building or serving, you need to set the env variable to the password, otherwise the build will fail with "Empty password found for level 'secret' and user 'user1'!"

alandrebraga commented 7 months ago

Make sense! Can we make doc more clear including this second part of instruction? If you don't mind I can do it.

Is easy to find the minimal mkdocs as you said, but the usage of the meta level to put the password on file is not

unverbuggt commented 7 months ago

Yes, maybe we need to make more clear what exactly a meta tag is and where to put it in a markdown file.

Feel free to clone and edit the usage documentation page: https://github.com/unverbuggt/mkdocs-encryptcontent-plugin/blob/version3/documentation/docs/usage.md and open a PR.

But let's keep this issue open until the documenation is extended.

alandrebraga commented 7 months ago

I'm going to add more about meta tag on the docs, but i will add a section about the meta tage too. Is there any place i can read more about this?

unverbuggt commented 7 months ago

https://www.mkdocs.org/user-guide/writing-your-docs/#meta-data

It seems like a good practice to use yaml style to make it more distinct where the head is and where the markdown starts. But t.b.h. I've never tested the style introduced with ---.