I noticed this solution does not work any longer. It was the first thing I tried before googling and finding this post. I’ll keep looking for a solution. Surprisingly, even www.example.com is converted into a hyperlink if on the same line as a regular link.
Looks like I’ll be using www<span>.</span>example<span>.</span>com
www.example.com
Preformatted text has other meanings. I reject the premise in the first post, it reads like “how can I avoid hitting myself if I really like hitting myself?”
I just want to be able to type out a domain name as text (without formatting/styling) and have enough OCD not only go to length of using <span>.</span>, but also to spend time finding out why \. doesn’t work as expected and post about it.
Fortunately, not everyone is cursed with my level of OCD.
Zero width Unicode spacers would also work but anyone who copies and pastes that URL is in for a surprise.. and not the good kind! Dunno if @sam has any other ideas but the request is really odd.
We had a similar request with complaints about m.sc being autolinked.
I do wonder if we should side with @Vitaly here and disable linkify fuzzy out of the box. Cause https://cnn.com will continue to work even if linkify fuzzy is disabled. So all you do is lose out on www.cnn.com
I think we should probably amend the test here to have a simpler bypass for fuzzy, just not sure what it would be
Well, using ` does turn the text into a <code></code> section instead of <pre></pre> which is preformatted text.
@notriddle Technically speaking there is a difference, but there really is no reason why <code></code> can’t be acceptable – URL’s are a form of “code” afterall.
Well said. The few cases where it has come up for me are when I’m trying to point someone to one url instead of another – i.e., when I’m trying to de-emphasize a URL. For example:
A: Just use smile.amazon.com instead of amazon.com and select OpenMRS, Inc. as your charity.
B: Just use smile.amazon.com instead of amazon.com and select OpenMRS, Inc. as your charity.
B is certainly a reasonable workaround; personally I prefer A. But, this is such an embarrassingly small issue, I can’t justify anyone (including myself) spending time on it. I’ve got amazon<span>.</span>com as a workaround for the 1-2 times I’ll ever need this again, so I’m happy… clearly afflicted with too much focus on meaningless details… but happy.
The awesome folks working on Discourse have more important things to do. I recommend focusing on other ways to continue making Discourse the most awesome forum software in the world and let this thread fade away. I’m sure I’ll re-discover this thread in a few years when this comes up again, so won’t need to post about it ever again.
(and I promise to not suggest a Discourse GSoC project to add support for www\.example\.com)
El propósito principal de nuestro foro es hablar sobre una empresa llamada Alarm.com, por lo que los usuarios escriben ‘Alarm.com’ en los mensajes constantemente, probablemente en el 50% de los temas. Terminaremos enlazando a Alarm.com de forma no intencional con mucha frecuencia.
Intenté desactivar linkify por completo, pero eso genera un problema mayor, ya que entonces los usuarios no pueden poner una URL en una línea por sí sola para obtener un onebox.
Nos encantaría tener una forma de desactivar linkify fuzzy para evitar este problema, pero seguir pudiendo enlazar URLs completas. ¿Es posible?
Siguiendo el hilo… Parece que si cambias las defaultOptions en vendor/assets/javascripts/markdown-it.js para que fuzzyLink sea false, como sugirió Sam, se soluciona mi problema. Pero hacerlo crea un gran dolor de cabeza, ya que no queremos tener que rehacer ese cambio manualmente cada vez que actualicemos.
Luego tropecé con una solución más sencilla. La configuración markdown linkify tlds es una lista de dominios de nivel superior que se asumen como URLs mediante el enlace difuso (fuzzy linking). Si eliminas todos esos TLD y añades solo un TLD falso que nunca aparecería realmente en una publicación, esto deshabilita efectivamente fuzzyLink. Necesitas al menos un TLD en la lista o, al parecer, cualquier cosa que termine con un . se tratará como un enlace.
Así que no es necesario cambiar el código; podemos deshabilitar fuzzyLink eliminando los TLD reales de la configuración y añadiendo uno falso.
Agrega \u003cspan\u003e\u003c/span\u003e en medio del texto.
Detalles
Nuestro sitio tiene SWI-Prolog agregado al componente del tema Auto enlazar palabras.
Para evitar que SWI-Prolog se convierta en un enlace, por ejemplo SWI-Prolog, y también para que no se muestre como una sección de código, por ejemplo SWI-Prolog, agregar \u003cspan\u003e\u003c/span\u003e en medio del texto, por ejemplo SWI\u003cspan\u003e\u003c/span\u003e-Prolog, hace que el texto no sea reconocido por Auto enlazar palabras. Dado que \u003cspan\u003e\u003c/span\u003e se renderiza en algo que no aparecerá en un navegador, funciona como se necesita para el caso específico, por ejemplo SWI-Prolog.
Puedes usar <span></span> para rodear el dominio convertido en enlace, en lugar de insertarlo en medio. Esto es útil al hablar de empresas y otros nombres propios que contienen puntos, como itch.io.
Por ejemplo, si simplemente escribes itch.io en el editor Markdown, se convertirá automáticamente en un enlace: itch.io
Pero también puedes escribir <span>itch.io</span>, y entonces no se convertirá en enlace: itch.io
No es necesario insertar <span></span> en medio del dominio, como en itch<span></span>.io, aunque eso también funciona: itch.io
(Iría bien que @precessor o un moderador cambiaran la casilla de verificación “ Solución” a esta respuesta en lugar de la solución actualmente seleccionada; la solución antigua funcionaba en 2016, pero ya no funciona hoy.)
Porque el formato no es importante. Solo lo que obtienes lo es. Y el propósito aquí es prevenir el hiperenlazado, y mi solución sigue siendo la más fácil. Y la más rápida