title: Add extra info (copyright notice/read more link) to copied text and preserve formatting (line breaks and color)
body: <p>I am using this code to add a read more link to my copied text but <strong>the line breaks and formatting are ignored</strong>:</p>
  
  <pre><code> &lt;script type='text/javascript'&gt;
  function addLink() {
      var body_element = document.getElementsByTagName(&amp;#39;body&amp;#39;)[0];
      var selection;
      selection = window.getSelection();
    var pagelink = &amp;quot;&lt;br/&gt;&lt;br/&gt; Mai multe Bancuri pe: http://bancuricubarbatisifemei.blogspot.com/ &lt;br/&gt;&amp;quot;; // change this if you want
      var copytext = selection + pagelink;
      var newdiv = document.createElement(&amp;#39;div&amp;#39;);
      newdiv.style.position=&amp;#39;absolute&amp;#39;;
      newdiv.style.left=&amp;#39;-99999px&amp;#39;;
      body_element.appendChild(newdiv);
      newdiv.innerHTML = copytext;
      selection.selectAllChildren(newdiv);
      window.setTimeout(function() {
          body_element.removeChild(newdiv);
      },0);
  }
  document.oncopy = addLink;
  &lt;/script&gt;
  </code></pre>
  
  <p>How to preserve them?</p>