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

Not working in either local or hosted. #48

Closed jessenjonas closed 1 year ago

jessenjonas commented 1 year ago

I am unable to get the plugin to work, at all. Neither locally on my device wiht MKdocs serve, or on github pages. No error given either.

installed using: pip install mkdocs-encryptcontent-plugin

Material Mkdocs : 9.1.21 Mkdocs : 1.5.2 Plugin: 2.5.3

My configuration :

site_name: My Docs
theme:
  name: material
  locale: en
  favicon: assets/images/Logo_Square_Thick.svg
  logo: assets/images/Logo_Square_Thick_White.svg
  palette:
    # Palette toggle for light mode
    - media: "(prefers-color-scheme: light)"
      scheme: default
      toggle:
        icon: material/toggle-switch-off-outline
        name: Switch to dark mode

    # Palette toggle for dark mode
    - media: "(prefers-color-scheme: dark)"
      scheme: slate
      toggle:
        icon: material/toggle-switch
        name: Switch to light mode

  plugins:
  - social:
  - search:
      lang: en
  - tags:
      tags_file: tags.md
  - encryptcontent:

  features:
    - navigation.instant
    - navigation.tracking
    - navigation.tabs
    - navigation.path
    - toc.follow
    - toc.integrate
    - navigation.top
    - search.suggest
    - search.highlight
    - search.share

  markdown_extensions:
  - abbr
  - admonition
  - def_list
  - footnotes
  - tables
  - pymdownx.details
  - pymdownx.caret
  - pymdownx.mark
  - pymdownx.tilde

extra_css:
  - assets/customization/css/custom.css

My testing file :

---
password: pwd
---
#Password Protected

Not being shown that the page is locked and i need to paste password to login.

unverbuggt commented 1 year ago

Hi,

you made en error in the yaml syntax. The plugins: section is on the theme: level (same for markdown_extensions:), but they need to be on the root (with no white spaces in front). This way the plugins won't get called.

With all the benefits of yaml, at least one downside remains: bad visibility of white spaces. As a rule of thumb: use at least four white spaces for indention. Also, some text editors allow you to display the white spaces, this might also help the visibility.

This works:

site_name: My Docs
theme:
  name: material
  locale: en
  favicon: assets/images/Logo_Square_Thick.svg
  logo: assets/images/Logo_Square_Thick_White.svg
  palette:
    # Palette toggle for light mode
    - media: "(prefers-color-scheme: light)"
      scheme: default
      toggle:
        icon: material/toggle-switch-off-outline
        name: Switch to dark mode

    # Palette toggle for dark mode
    - media: "(prefers-color-scheme: dark)"
      scheme: slate
      toggle:
        icon: material/toggle-switch
        name: Switch to light mode

  features:
    - navigation.instant
    - navigation.tracking
    - navigation.tabs
    - navigation.path
    - toc.follow
    - toc.integrate
    - navigation.top
    - search.suggest
    - search.highlight
    - search.share

markdown_extensions:
  - abbr
  - admonition
  - def_list
  - footnotes
  - tables
  - pymdownx.details
  - pymdownx.caret
  - pymdownx.tilde
  - pymdownx.mark

plugins:
  #- social:
  - search:
      lang: en
  #- tags:
  #    tags_file: tags.md
  - encryptcontent: {}

extra_css:
  #- assets/customization/css/custom.css
jessenjonas commented 1 year ago

Hi,

you made en error in the yaml syntax. The plugins: section is on the theme: level (same for markdown_extensions:), but they need to be on the root (with no white spaces in front). This way the plugins won't get called.

With all the benefits of yaml, at least one downside remains: bad visibility of white spaces. As a rule of thumb: use at least four white spaces for indention. Also, some text editors allow you to display the white spaces, this might also help the visibility.

This works:

site_name: My Docs
theme:
  name: material
  locale: en
  favicon: assets/images/Logo_Square_Thick.svg
  logo: assets/images/Logo_Square_Thick_White.svg
  palette:
    # Palette toggle for light mode
    - media: "(prefers-color-scheme: light)"
      scheme: default
      toggle:
        icon: material/toggle-switch-off-outline
        name: Switch to dark mode

    # Palette toggle for dark mode
    - media: "(prefers-color-scheme: dark)"
      scheme: slate
      toggle:
        icon: material/toggle-switch
        name: Switch to light mode

  features:
    - navigation.instant
    - navigation.tracking
    - navigation.tabs
    - navigation.path
    - toc.follow
    - toc.integrate
    - navigation.top
    - search.suggest
    - search.highlight
    - search.share

markdown_extensions:
  - abbr
  - admonition
  - def_list
  - footnotes
  - tables
  - pymdownx.details
  - pymdownx.caret
  - pymdownx.tilde
  - pymdownx.mark

plugins:
  #- social:
  - search:
      lang: en
  #- tags:
  #    tags_file: tags.md
  - encryptcontent: {}

extra_css:
  #- assets/customization/css/custom.css

That works! I don't know how I missed that! Thanks!