Copy codeblock contents to clipboard

:mega: Now live in core Discourse is the ability to show a copy button for codeblocks!

import { createWidget } from 'discourse/widgets/widget';

createWidget('my-widget', {
  tagName: 'div.hello',

  html() {
    return "hello world";
  }
});

This feature is off by default, but if your community could benefit from it, you can turn it on by enabling the show copy button on codeblocks site setting.

Some notes about the feature:

38 Likes