Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live edit controls aren't showing. #5

Open
MarcoCaspers opened this issue Sep 9, 2024 · 0 comments
Open

Live edit controls aren't showing. #5

MarcoCaspers opened this issue Sep 9, 2024 · 0 comments

Comments

@MarcoCaspers
Copy link

MarcoCaspers commented Sep 9, 2024

Today I installed mkdocs and this plugin, however simple in nature, it didn't work for me.
I did some digging around and i found that while all seemed to be working fine the initializate function in the live-edit.js file was failing.
The problem is that this line:

let article = document.querySelector('article'); returns nothing.

I tested this by adding an else clause: if (article) { ... } else { alert("we got here."); }

mkdocs in version 1.6.1 apparently doesn't render that article element anymore.
For me i was able to fix this by changing the article line in the live-edit.js file into this:

let article = document.querySelector('[itemprop="articleBody"]');

With this in place it was properly showing the live edit control bar.

Just so you know this was with both plain vanilla mkdocs theme, as well as with the readthedocs theme. I do not know if that is of any consequence for the outcome.

Just for reference, this is how my mkdocs.yml file looks like:

site_name: "My technical documentation doodles"
nav:
  - Home: index.md
  - Development: development.md
  - Cli tools: cli.md
  - Security: security.md
  - Testing: testing.md
  - How to: howtos.md
  - Troubleshooting: troubleshooting.md
  - License: license.md
markdown_extensions:
  - codehilite:
      guess_lang: false
extra_javascript:
  - https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.0/highlight.min.js
extra_css:
  - https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.0/styles/default.min.css
theme: 
  name:
    readthedocs
plugins:
  - live-edit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant