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 Me gusta

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 Me gusta

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 me gusta

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

3 Me gusta

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

1 me gusta

Intenté leer todas las publicaciones, pero después de las primeras varias, comencé a solo ojearlas.

También probé los convertidores en línea con

\+ exist

A \= b

pero no convirtieron el \ en \\, por lo que el código\text aparece como

+ exist

A = b


Nuestro sitio (SWI-Prolog) es para el lenguaje de programación Prolog SWI-Prolog y muchas publicaciones contienen código fuente de Prolog. Dado que Prolog es un lenguaje de programación lógica basado en tres operadores lógicos básicos, and, or y not, y not generalmente se representa con el carácter \ cuando se usa con operadores comunes, por ejemplo \=/2 y \+/1, y Markdown utiliza \ como un carácter de escape, a menudo los operadores que se pegan en línea y no en fragmentos de código no aparecen como \= o \+, sino como = o +, porque la conversión de Markdown consume el \ pensando que es un escape.

¿Se puede solucionar esto? :smiley:

Necesitarás pegarlo en un bloque de código, así que escribe tres comillas invertidas, presiona enter, luego pega.

1 me gusta

Gracias,

la mayoría de los usuarios delimitan los bloques de código con ```prolog y ```, y lo indiqué en mi publicación para aquellos que no lo hacen.

El problema surge cuando se trata de texto en línea. Como sabemos, muchos usuarios no revisan lo que publican, o cuando lo hacen, es fácil pasar por alto una barra invertida \ faltante. :smiley:


Detalles de la publicación dirigida a los usuarios de SWI-Prolog

Si usas el carácter \ en texto en línea, por ejemplo \= o \+, se convertirá en = o +, lo cual probablemente no es lo que deseabas. Aunque Discourse intenta ser inteligente al convertir el texto pegado a HTML, también utiliza Markdown, y Markdown usa \ como carácter de escape.

Ejemplo de hacerlo mal: = y +.

Para código en línea, simplemente delimita el texto con `, por ejemplo `\=` o `\+`, que aparece como \= o \+.

o

simplemente duplica las barras, por ejemplo, pegar \\= o \\+ aparece como \= o \+.

Sin embargo, si tienes varias líneas de código, delimita la sección de código con ```prolog y ```, y la sección de código será convertida por el convertidor de código fuente para Prolog, que deja la \ intacta.

A \= b.
\+ true.

Incluso cuando pegué la copia aquí, tuve que volver al HTML original y copiar eso en lugar del texto para asegurarme de que fuera correcto.

¡Cierro esto como completado! Gran trabajo @vinothkannans al construir esto.

Las mejoras futuras pueden ir en nuevos temas de errores o características.

7 Me gusta