Search code examples
mkdocsmkdocs-material

Why are code snippets uncopyable when using "mkdocs build"?


Why code snippets can be copied when running "mkdocs serve" with the mkdocs-material theme, but not when using "mkdocs build"?

Using mkdocs serve is resulting in:

abcd

Using mkdocs build there is no "copied" button:

enter image description here

How can I enable copying of code snippets in the static files generated by mkdocs build?


Solution

  • Refer: mkdocs-material docs

    I found out that I wrote one less feature parameter in the latest version, as follow:

    theme:
      name: material
      features:
        - announce.dismiss
        - content.action.edit
        - content.action.view
        - content.code.annotate
        - content.code.copy