mkdocs-markmap icon indicating copy to clipboard operation
mkdocs-markmap copied to clipboard

Markmap works only after refreshing webpage

Open andynameistaken opened this issue 3 years ago • 3 comments

  • Version: 2.3.0
  • Screenshot before refresh: image

andynameistaken avatar Sep 07 '22 17:09 andynameistaken

I'm unable to reproduce the issue. Please provide more information:

  • Browser (incl. version)
  • Screenshot of browser console output before refresh
  • Archive of your docs/ and site/ folders as well as mkdocs.yml file
  • Output of python --version
  • Output of pip freeze

neatc0der avatar Sep 08 '22 17:09 neatc0der

  • Tested browsers:
    • Microsoft Edge: Version 105.0.1343.33
    • Firefox: 104.0.2
  • Screenshot: image
  • Could I send you my docs and site via email or something? It has my personal notes.
  • mkdocs.yml
#  Project information
site_name: 'Code Notes'
site_description: 'Programming Notes'
site_author: 'Andrzej Zahorski'



# Repository
# repo_name: ''
# repo_url: ''

# Copyright
copyright: 'Copyright © 2022 Andrzej Zahorski'

# Plugins
# Plugins
plugins:
  - search
  - markmap
  - autolinks 
  - roamlinks
  - mkdocs-jupyter:
      # execute: True
      include_source: True
      # theme: base-16-gruvbox-dark

      # theme: slate
      # include_source: True

  - literate-nav:
      nav_file: repos/SUMMARY.md
  - mermaid2:
      arguments:
        # test if its __palette_1 (dark) or __palette_2 (light)
        # for mkdocs-material >=8.0.0
        theme: |
          ^(JSON.parse(__md_get("__palette").index == 1)) ? 'dark' : 'light'
#       for mkdocs-material <8.0.0
#         ^(JSON.parse(window.localStorage.getItem(__prefix('__palette'))).index == 1) ? 'dark' : 'light'

       
  
  # - encryptcontent:
  #     global_password: 'test'
  #     remember_password: True
  #     decrypt_search: True



## Extensions
markdown_extensions:    
  - footnotes
  - pymdownx.highlight:
      linenums: true           
  - pymdownx.inlinehilite  
  - pymdownx.keys
  - pymdownx.snippets  
  - admonition
  - pymdownx.details  
  - attr_list
  - pymdownx.critic
  - pymdownx.caret
  - pymdownx.mark
  - pymdownx.tilde
  - tables

  # LaTeX
  - pymdownx.arithmatex:
      generic: true
  - pymdownx.superfences:
      # make exceptions to highlighting of code:
      custom_fences:
        - name: mermaid
          class: mermaid
          format: !!python/name:mermaid2.fence_mermaid    
  - pymdownx.tabbed:
      alternate_style: true 
 
  # - attr_list
  # - pymdownx.arithmatex
  # - pymdownx.details
  # - pymdownx.magiclink
  # - pymdownx.tasklist:
  #     custom_checkbox: true
#  - pymdownx.emoji:
#      emoji_generator: !!python/name:pymdownx.emoji.to_svg


  - toc:
      permalink: true

# ================================================
#         THEME                                  #
# ================================================

theme:
  name: material
  font:
    # text: Sarala
    text: Montserrat
  features:
    - navigation.top
    - search.suggest    
    - search.highlight     
    - search.share        
    - navigation.indexes
    - navigation.instant
    - navigation.tabs
    # - navigation.tabs.sticky
  custom_dir: overrides






  language: 'en'
  # logo: 'images/logo.png'
  # favicon: 'images/logo.png'
  palette:
    - media: "(prefers-color-scheme: light)"
      primary: deep purple
      scheme: default
      toggle:
        icon: material/weather-night
        name: Switch to dark mode
    - media: "(prefers-color-scheme: dark)"
      scheme: slate
      accent: green
      # primary: deep purple
      toggle:
        icon: material/weather-sunny
        name: Switch to light mode
 
extra_css:
  - 'stylesheets/extra.css'  

  
  

# Customisation
extra:
  social:
    - icon: fontawesome/brands/github
      link: https://github.com/andynameistaken
  generator: false

    



extra_javascript:
  # LaTeX support
  - javascripts/mathjax.js
  - https://polyfill.io/v3/polyfill.min.js?features=es6
  - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
  # Mermaid Graph
  - extra/refresh_on_toggle_dark_light.js
  - https://unpkg.com/mermaid/dist/mermaid.min.js
  # sortable data tables
  - https://cdnjs.cloudflare.com/ajax/libs/tablesort/5.2.1/tablesort.min.js
  - javascripts/tablesort.js

  • Python 3.10.6
  • pip freeze:
anyio==3.6.1
appnope==0.1.3
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
asttokens==2.0.8
attrs==20.3.0
Babel==2.10.3
backcall==0.2.0
beautifulsoup4==4.11.1
bleach==5.0.1
certifi==2022.6.15
cffi==1.15.1
charset-normalizer==2.1.1
click==8.1.3
debugpy==1.6.3
decorator==5.1.1
defusedxml==0.7.1
EditorConfig==0.12.3
entrypoints==0.4
executing==1.0.0
fastjsonschema==2.16.1
ghp-import==2.1.0
idna==3.3
importlib-metadata==4.12.0
ipykernel==6.15.2
ipython==8.5.0
ipython-genutils==0.2.0
jedi==0.18.1
Jinja2==3.1.2
jsbeautifier==1.14.6
json5==0.9.10
jsonschema==4.15.0
jupyter-core==4.11.1
jupyter-server==1.18.1
jupyter_client==7.3.5
jupyterlab==3.4.6
jupyterlab-pygments==0.2.2
jupyterlab_server==2.15.1
jupytext==1.14.1
lxml==4.9.1
Markdown==3.3.7
markdown-it-py==2.1.0
MarkupSafe==2.1.1
matplotlib-inline==0.1.6
mdit-py-plugins==0.3.0
mdurl==0.1.2
mergedeep==1.3.4
mistune==0.8.4
mkdocs==1.3.1
mkdocs-autolinks-plugin==0.6.0
mkdocs-jupyter==0.21.0
mkdocs-literate-nav==0.4.1
mkdocs-markmap==2.3.0
mkdocs-material==8.4.3
mkdocs-material-extensions==1.0.3
mkdocs-mermaid2-plugin==0.6.0
mkdocs-roamlinks-plugin==0.2.0
nbclassic==0.4.3
nbclient==0.6.7
nbconvert==6.5.3
nbformat==5.4.0
nest-asyncio==1.5.5
notebook==6.4.12
notebook-shim==0.1.0
packaging==21.3
pandocfilters==1.5.0
parso==0.8.3
pexpect==4.8.0
pickleshare==0.7.5
prometheus-client==0.14.1
prompt-toolkit==3.0.31
psutil==5.9.2
ptyprocess==0.7.0
pure-eval==0.2.2
pycparser==2.21
Pygments==2.13.0
pymdown-extensions==9.5
pyparsing==3.0.9
pyrsistent==0.18.1
python-dateutil==2.8.2
pytz==2022.2.1
PyYAML==6.0
pyyaml_env_tag==0.1
pyzmq==23.2.1
requests==2.28.1
Send2Trash==1.8.0
six==1.16.0
sniffio==1.3.0
soupsieve==2.3.2.post1
stack-data==0.5.0
terminado==0.15.0
tinycss2==1.1.1
toml==0.10.2
tornado==6.2
traitlets==5.3.0
urllib3==1.26.12
watchdog==2.1.9
wcwidth==0.2.5
webencodings==0.5.1
websocket-client==1.4.1
zipp==3.8.1

andynameistaken avatar Sep 12 '22 11:09 andynameistaken

I prefer minimalistic examples that reproduce the issue, but OK. Let's try it with your input.

Here's what I did:

$ vim requirements.txt  # insert your `pip freeze` output
$ vim mkdocs.yml  # insert your `mkdocs.yml` output except for "custom_dir: overrides"
$ conda create -n markmap-reload -c conda-forge python=3.10.6
$ conda activate markmap-reload
$ pip install -r requirements.txt
$ mkdocs build  # used minimalistic input with index.md that references a simple markmap

Then, I opened it up in Firefox 104.0.2 on macOS 12.6: everything works just fine... Still unable to reproduce.

My suggestion: Please provide a minimalistic example that reproduces the issue for you, e.g.: docs/index.md

Look at this beautiful mindmap:

```markmap
# Root

## Branch 1

## Branch 2
```

neatc0der avatar Sep 13 '22 20:09 neatc0der

I apologize for the previous incorrect statement. What should really be turned off is the navigation.instant feature of the theme. This feature preloads pages to improve page load speed, but it affects the re-execution of JS files. Turning off this attribute allows for automatic refresh when navigating between pages.

CleanShot 2023-10-04 at 18 06 09@2x

libukai avatar Oct 04 '23 06:10 libukai