question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Copy code block icon no longer appearing

See original GitHub issue

I’ve found a bug and checked that …

  • … the problem doesn’t occur with the default MkDocs template
  • … the problem is not in any of my customizations (CSS, JS, template)
  • … the documentation does not mention anything about my problem
  • … there are no open or closed issues that are related to my problem

Description

The updated Material theme (I am using insiders) no longer allows the user to copy code blocks with the click of a button. To test I created a new project and updated my mkdocs.yaml with the plugins/extensions I am using.

When hovering over the code block there is normally an icon for the user to click on to copy the code block. With the updated version this does not appear.

Expected behavior

Icon to copy the code block text should appear when hovering over the code block.

Actual behavior

The icon to copy the code block does not appear.

Steps to reproduce the bug

  1. Create a new project
  2. Add plugins/extensions to yaml
  3. Update index.md to have a simple code block
  4. Hover over the code block, the copy icon does not appear

Package versions

  • Python: python --version ** Python 3.8.5
  • MkDocs: mkdocs --version ** mkdocs, version 1.1.2
  • Material: pip show mkdocs-material | grep -E ^Version ** Version: 7.0.5+insiders.2.2.1
Package                                   Version
----------------------------------------- --------------------
Babel                                     2.9.0
beautifulsoup4                            4.9.3
bs4                                       0.0.1
certifi                                   2020.12.5
chardet                                   4.0.0
click                                     7.1.2
future                                    0.18.2
gitdb                                     4.0.5
GitPython                                 3.1.13
idna                                      2.10
install                                   1.3.4
Jinja2                                    2.11.3
joblib                                    1.0.1
livereload                                2.6.3
lunr                                      0.5.8
Markdown                                  3.3.4
MarkupSafe                                1.1.1
mike                                      0.5.5
mkdocs                                    1.1.2
mkdocs-git-revision-date-localized-plugin 0.8
mkdocs-localsearch                        0.9.0
mkdocs-macros-plugin                      0.5.5
mkdocs-macros-test                        0.1.0
mkdocs-material                           7.0.5+insiders.2.2.1
mkdocs-material-extensions                1.0.1
mkdocs-versioning                         0.4.0
nltk                                      3.5
packaging                                 20.9
pip                                       21.0.1
Pygments                                  2.7.4
pymdown-extensions                        8.1.1
pyparsing                                 2.4.7
python-dateutil                           2.8.1
pytz                                      2021.1
PyYAML                                    5.4.1
regex                                     2020.11.13
repackage                                 0.7.3
requests                                  2.25.1
ruamel.yaml                               0.16.12
ruamel.yaml.clib                          0.2.2
setuptools                                53.0.0
six                                       1.15.0
smmap                                     3.0.5
soupsieve                                 2.2
termcolor                                 1.1.0
tornado                                   6.1
tqdm                                      4.56.2
urllib3                                   1.26.3

Project configuration

site_name: My Docs

# If serving from a website you would want 'true', for offline you want false
use_directory_urls: false

nav:
  - Home:
    - Introduction: index.md

theme:
  name: 'material'
  custom_dir: theme
  features:
    - navigation.tabs
    - navigation.tabs.sticky
    - navigation.indexes
    - navigation.instant
    - search.highlight
    - search.share
    - search.suggest
    - header.hide
    - toc.autohide

extra:
  generator: false

markdown_extensions:
  - abbr
  - admonition
  - attr_list
  - def_list
  - footnotes
  - pymdownx.details
  - pymdownx.emoji:
      emoji_index: !!python/name:materialx.emoji.twemoji
      emoji_generator: !!python/name:materialx.emoji.to_svg
  - pymdownx.highlight:
      use_pygments: true
  - pymdownx.inlinehilite
  - pymdownx.keys
  - pymdownx.superfences:
      custom_fences:
        - name: mermaid
          class: mermaid-experimental
          format: !!python/name:pymdownx.superfences.fence_code_format
  - pymdownx.tabbed
  - toc:
      permalink: '#'
      toc_depth: 5

plugins:
  - search:
      prebuild_index: false
  - localsearch

System information

  • OS: macOS Big Sur v11.2.2

  • Browser: Brave 1.21.74

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Vasperouscommented, Mar 10, 2021

Confirmed that following the directions under the localsearch project fixed the issue. Thank you! https://github.com/wilhelmer/mkdocs-localsearch

0reactions
Vasperouscommented, Mar 10, 2021

Argh I am kicking myself, I saw that part of the upgrade guide but it didn’t dawn on me that it would impact me in that way. My apologies, making the update now and will confirm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - Copy code block icon no longer appearing -
Copy code block icon no longer appearing ... I've found a bug and checked that ... [x] ... the problem doesn't occur with...
Read more >
The codeblock copy button and comments are not shown #3420
The codeblock copy button and comments are not shown. Expected behaviour. There should be an icon to copy the codeblock and the comments...
Read more >
Copy code block text button? : r/bearapp - Reddit
Hi! I do love using Bear, you guys have done a great job with this. I was wondering about the ability to copy...
Read more >
How to add a copy button in the code blocks for RST/Read the ...
It's straightforward to use. # Install pip install sphinx-copybutton # Declare it in the conf.py extensions = [ ... 'sphinx_copybutton' ... ] And ......
Read more >
1 Code::Blocks Project Management
Code ::Blocks settings are saved as application data in a file called <user>.conf in the codeblocks directory. This configuration file contains information such ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found