Install and customize the Fragment Copy Button extension
mainDisplays a copy button when hovering over code fragments.
Installation
- In your
Doxyfile, add:HTML_EXTRA_FILES:doxygen-awesome-fragment-copy-button.jsHTML_COPY_CLIPBOARD:NO(Required if using Doxygen >= 1.10.0).
- In
header.html, include the script at the end of the<head>and initialize:
<head>
<!-- ... -->
<script type="text/javascript" src="$relpath^doxygen-awesome-fragment-copy-button.js"></script>
<script type="text/javascript">
DoxygenAwesomeFragmentCopyButton.init()
</script>
</head>Customization
Note: All customizations must be applied before calling .init().
- Change tooltip:
DoxygenAwesomeFragmentCopyButton.title = "Copy to clipboard" - Change icons (SVG only):
DoxygenAwesomeFragmentCopyButton.copyIcon = `<svg ...>` DoxygenAwesomeFragmentCopyButton.successIcon = `<svg ...>`
<script type="text/javascript" src="$relpath^doxygen-awesome-fragment-copy-button.js"></script>
<script type="text/javascript">
DoxygenAwesomeFragmentCopyButton.init()
</script>