HTML/RTF pasting

Yes, I know that. What I’m saying is, I don’t think most users know “paste as plain text” is even an option. It pretty much negates the usefulness of code blocks.

You can turn formatted pasting off globally in your site settings if you are a site owner.

Thanks for letting me know. I’m not the site owner, but I’ll bring up that option with the site owner and see what they think.

EDIT: @codinghorror Am I correct in assuming that there is no user-level setting?

I have been running into this too. Don’t know if it is a recent development but just started noticing it. I use discourse to reply to email often. When I do, I hit reply in the email and then copy and paste the entire email text into my discourse message. It recognizes one level of quoting correctly but encodes the second and third level. So I have to first paste into a plain text editor and do global search and replace, then edit, to get it to look as expected in discourse.

use ctrl+shift+v, it is your friend :wink:

4 Likes

If I want to lose all the other formatting too, then yes.

I will try this out next time and see how it turns out.

Thanks.

What about when you’re responding from your phone? At least iPhone doesn’t have the option to paste in plaintext.

Does iPhone retain formatting when copying? I’m not sure it even does?

It does. I just tried it.

4 Likes

Perhaps it would make sense to add a button on the reply menu for doing a plain text paste? Though space there is already a little tight on my iPhone 8…

1 Like

@seanblue @tobiaseigen thanks for the report. I will definitely try to improve this. But it’s not in my current priority list.

3 Likes

I agree, a plain text menu option would be great when I’m working from my phone.

1 Like

Tried to read all of the post, but after the first several started to just skim them.

Also tried the on-line converters with

\+ exist

A \= b

but they did not convert the \ to \\ so instead the code\text comes out as

+ exist

A = b


Our site (SWI-Prolog) is for the Prolog programming language SWI-Prolog and many post contain Prolog source code. Since Prolog is a logic programming language built on three basic logical operators, and, or, and not, and not is typically represented by the character \ when used with common operators, e.g.\=/2 and \+/1 and Markdown uses the \ as an escape character,
often operators that are pasted when inline and not in code samples don’t show up as \= or \+ but as = or + because the Markdown conversion eats the \ thinking it is an escape.

Can this be fixed. :smiley:

You will need to paste into a code block, so type three backticks, press enter, then paste?

1 Like

Thanks,

most users do bookend code blocks with ```prolog and ``` and I noted in my post for those that don’t.

The problem is when it is in line text. As we know many users do not proof read what they post, or when they do it is easy to miss a missing \. :smiley:


Details of post to users at SWI-Prolog

If you use the \ character with in-line text, e.g. \= or \+ it will be converted to = or + which is probably not what you desired. While Discourse tries to be intelligent abut converting pasted text to HTML, it also uses Markdown and Markdown uses \ as an escape character.

Example of doing it wrong, = and +.

For in-line code just bookend the text with `, e.g. `\=` or `\+` which appears as\= or \+.

or

just double up on the \, e.g. pasting \\= or \\+ appears as \= or \+.

However if you have several lines of of code, bookend the code section with ```prolog and ``` and the code section will be converted by the source code converter for Prolog which leaves the \ alone.

A \= b.
\+ true.

Even when I pasted the copy here I had to go back to the original HTML and copy that instead of the text to make sure it was correct.

I am closing this as complete! Awesome job @vinothkannans building this.

Future refinements can go in new bug/feature topics.

7 Likes