6

I would like to be able to paste rich text that I've copied (for example) from a webpage directly into notepad (or other plain text box) and retain details like urls etc.

For example, if I copied text from a webpage that read "Stackexchange" (notice how it has a clickable link to "http://stackexchange.com"), pasting to wordpad or some office program, will paste as clickable text. It would be great to be able to paste directly in notepad as

http://stackexchange.com Stackexchange

or

<a href="http://stackexchange.com">Stackexchange</a>

or similar.

I thought a clipboard manager should be able to do this, so I tried CLC and ArsClip. In CLC I could at least see the raw html but no obvious way to get that on to the clipboard. I could save it to a file, but that's not practical.

6
  • 1
    superuser.com/questions/484214/filter-rich-text-on-clipboard may be a related question
    – aland
    Mar 24, 2013 at 16:46
  • Well, copy the source code instead.
    – ayckoster
    Mar 24, 2013 at 17:00
  • that works okay in some circumstances ayckoster, e.g. firefox - but doesn't work so well when using ctrl+click to select table cells nor when using chrome
    – aland
    Mar 24, 2013 at 17:19
  • 1
    In chrome just right click provides option "Copy Link Address", will it not do the purpose ?
    – Ankit
    Apr 18, 2013 at 13:36
  • 1
    I love this question and don't think anyone has really answered it very well. I wish some program or plugin would enable me to copy/paste from rich text to plain text but have hyperlinks converted to something like StackExchange[http://stackexchange.com], which is what email systems do.
    – Ryan
    Feb 6, 2016 at 2:44

3 Answers 3

6
+50

Try using "Paste Special"

Notepad++ has an option, [Edit, Paste Special, Paste HTML Content]. Copying from various browsers gives different results. I've copied the same section from your question in each browser, and pasted it into Notepad++.

From Firefox:

Version:0.9
StartHTML:00000177
EndHTML:00000550
StartFragment:00000211
EndFragment:00000514
SourceURL:http://superuser.com/questions/570820/paste-rich-text-with-formating
<html><body>
<!--StartFragment-->For example, if I copied text from a webpage that read "Stackexchange" and was a clickable link to "<a href="http://stackexchange.com">http://stackexchange.com</a>",
 pasting to wordpad or some office program, will paste as clickable 
text. It would be great to be able to paste directly in notepad as<!--EndFragment-->
</body>
</html>

From Chrome:

Version:0.9
StartHTML:0000000185
EndHTML:0000002191
StartFragment:0000000221
EndFragment:0000002155
SourceURL:http://superuser.com/questions/570820/paste-rich-text-with-formating
<html>
<body>
<!--StartFragment--><span style="color: rgb(0, 0, 0); font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;">For example, if I copied text from a webpage that read "Stackexchange" and was a clickable link to "</span><a href="http://stackexchange.com/" style="margin: 0px; padding: 0px; border: 0px; font-size: 14px; vertical-align: baseline; background-color: rgb(255, 255, 255); color: rgb(19, 179, 189); text-decoration: none; cursor: pointer; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-position: initial initial; background-repeat: initial initial;">http://stackexchange.com</a><span style="color: rgb(0, 0, 0); font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none;">", pasting to wordpad or some office program, will paste as clickable text. It would be great to be able to paste directly in notepad as</span><!--EndFragment-->
</body>
</html>

From IE:

Version:1.0
StartHTML:000000231
EndHTML:000005122
StartFragment:000004682
EndFragment:000004996
StartSelection:000004682
EndSelection:000004996
SourceURL:http://superuser.com/questions/570820/paste-rich-text-with-formating
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD><TITLE>windows 7 - Paste rich text with formating - Super User</TITLE><LINK 
rel="shortcut icon" 
href="http://cdn.sstatic.net/superuser/img/favicon.ico"><LINK 
rel="apple-touch-icon image_src" 
href="http://cdn.sstatic.net/superuser/img/apple-touch-icon.png"><LINK 
title="Super User" rel=search type=application/opensearchdescription+xml 
href="/opensearch.xml">
<SCRIPT type=text/javascript 
src="http://engine.adzerk.net/z/8476/adzerk1_2_4_46,adzerk2_2_17_47?keywords=windows-7,clipboard" 
async="true"></SCRIPT>

<SCRIPT type=text/javascript src="http://www.google-analytics.com/ga.js" 
async="true"></SCRIPT>

<SCRIPT type=text/javascript src="http://edge.quantserve.com/quant.js" 
async="true"></SCRIPT>

<SCRIPT type=text/javascript 
src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></SCRIPT>

<SCRIPT type=text/javascript 
src="http://cdn.sstatic.net/js/stub.js?v=1f945f8e69cb"></SCRIPT>
<LINK rel=stylesheet type=text/css 
href="http://cdn.sstatic.net/superuser/all.css?v=8eaaa600ccef"><LINK 
rel=canonical 
href="http://superuser.com/questions/570820/paste-rich-text-with-formating"><LINK 
title="Feed for question 'Paste rich text with formating'" rel=alternate 
type=application/atom+xml href="/feeds/question/570820">
<SCRIPT type=text/javascript>

        StackExchange.ready(function () {
            StackExchange.using("postValidation", function () {
                StackExchange.postValidation.initOnBlurAndSubmit($('#post-form'), 2, 'answer');
            });


            StackExchange.question.init({hasOpenBounty:true,showAnswerHelp:true,totalCommentCount:4,shownCommentCount:4,highlightColor:'#BEB013',backgroundColor:'#FFF',questionId:570820});

            styleCode();

                StackExchange.realtime.subscribeToQuestion('3', '570820');


        });
    </SCRIPT>

<SCRIPT type=text/javascript>
        StackExchange.ready(function () {
            StackExchange.realtime.init('ws://sockets.ny.stackexchange.com:80');
            StackExchange.realtime.subscribeToInboxNotifications();
                    StackExchange.realtime.subscribeToReputationNotifications('3');
                });
    </SCRIPT>

<SCRIPT type=text/javascript>
        StackExchange.init({"stackAuthUrl":"https://stackauth.com","serverTime":1366208314,"enableUserHovercards":true,"site":{"name":"Super User","description":"Q&A for computer enthusiasts and power users","isNoticesTabEnabled":true,"recaptchaPublicKey":"6LcDNwYAAAAAAG_X1rC8kTtLBP6XS2Ym1N0n9kSY","useNewStyleFavoriteTagsEditor":true,"enableSocialMediaInSharePopup":true},"user":{"fkey":"edbc1fe628205ffa4db5a492350fc54b","isAnonymous":true}});
        StackExchange.using.setCacheBreakers({"js/prettify-full.js":"6c261bebf56a","js/moderator.js":"f96f7e4ee5dc","js/full-anon.js":"4aa778f20142","js/full.js":"2cb347042411","js/wmd.js":"605c62dd1a01","js/third-party/jquery.autocomplete.min.js":"e5f01e97f7c3","js/mobile.js":"6eb68240242f","js/help.js":"fc9fb0517db2","js/tageditor.js":"450c9e8426fc","js/tageditornew.js":"b6c68ad4c7dd","js/inline-tag-editing.js":"8e84e8a137f7","js/revisions.js":"7273bb714bba","js/review.js":"5b2105439221","js/tagsuggestions.js":"aa48ef6154df","js/post-validation.js":"98fa812e7e1a","js/explore-qlist.js":"6c836f42bd92"});

    </SCRIPT>

<SCRIPT type=text/javascript>
        StackExchange.using("gps", function() {
             StackExchange.gps.init(true);
        });
    </SCRIPT>

<SCRIPT type=text/javascript 
src="http://cdn.sstatic.net/js/full-anon.js?v=4aa778f20142" 
async="async"></SCRIPT>

<SCRIPT type=text/javascript 
src="http://cdn.sstatic.net/js/post-validation.js?v=98fa812e7e1a" 
async="async"></SCRIPT>

<SCRIPT type=text/javascript 
src="http://static.adzerk.net/Extensions/adFeedback.js"></SCRIPT>
<LINK rel=stylesheet 
href="http://static.adzerk.net/Extensions/adFeedback.css"></HEAD>

<BODY class=question-page jQuery17103772600276367371="4">

<DIV class=container>

<DIV id=content>

<DIV itemtype="http://schema.org/Article" itemscope>

<DIV id=mainbar>

<DIV id=question class=question jQuery17103772600276367371="12" 
data-questionid="570820">

<TABLE>

<TBODY>

<TR>

<TD class=postcell>

<DIV>

<DIV class=post-text itemprop="description"><!--StartFragment--><P>For example, if I copied text from a webpage that read "Stackexchange" and 
was a clickable link to "<A 
href="http://stackexchange.com">http://stackexchange.com</A>", pasting to 
wordpad or some office program, will paste as clickable text. It would be great 
to be able to paste directly in notepad as</P><!--EndFragment--></DIV>
</DIV>
</TD>
</TR>
</TBODY>
</TABLE>
</DIV>
</DIV>
</DIV>
</DIV>
</DIV>
</BODY>
</HTML>
2
  • Thanks, I didn't notice but pspad also has this feature.
    – aland
    Apr 22, 2013 at 10:57
  • I wish the Edit > Paste Special > Paste Binary Content would paste (or a separate option were available to paste) from rich text to plain text but have hyperlinks converted to something like Stackexchange[http://stackexchange.com], which is what email systems do.
    – Ryan
    Feb 6, 2016 at 2:42
1

For your example about web pages, you can use Chrome and the developer tools :

CMD + Option + c to inspect the part you want to copy, and then in Elements explorer, right click on the node you want and choose Copy as HTML.

example of html copy

0

For Chrome:

Easiest way is to Right Click on the hyperlink. From Context menu Select option Inspect Element then press Ctrl+c to copy the link along with HTML formatting.

Alternatively:

I have created a AutoHotkey script to automate the whole process with just single Hotkey (Ctrl+m):

^m::
MouseClick, right
Sleep, 1000
Send, {DOWN  6}{ENTER}
Sleep, 1000
Send, {CTRLDOWN}c{CTRLUP}

With above script placing mouse on hyperlink and pressing Ctrl+m will copy the formatted link to clipboard.


For Firefox:

  • Keep mouse on link, then Right Click.
  • Press Q (or select Inspect Element).
  • Select Copy Outer HTML from drop down. Your link will be copied along with HTML formatting.

Firefox copy link address

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .