Hyperlink verhindern

How can I prevent a www.example.com URL from becoming a hyperlink, without (ab)using another formatting feature such as inline code formatting?

I notice I can quote: “www.example.com”, but I’d like to avoid that. Is it possible to somehow escape the auto-link change as I create/edit a post?

Backslashes?
www\.example\.com
www.example.com

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

Why in the world would you do any of that when you can simply use a proper code span with the ` key?

www.example.com

See Markdown Reference

Because it’s not code?

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. :wink:

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.

Yeah bypassing linkify is not easy:

https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js

and

https://github.com/markdown-it/linkify-it

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. :nerd_face:

(and I promise to not suggest a Discourse GSoC project to add support for www\.example\.com)

Der Hauptzweck unseres Forums ist die Diskussion über ein Unternehmen namens Alarm.com, weshalb Nutzer Alarm.com ständig in Beiträgen erwähnen, wahrscheinlich in etwa 50 % der Themen. Wir werden unfreiwillig sehr häufig auf Alarm.com verlinken.

Ich habe versucht, Linkify komplett zu deaktivieren, aber das führt zu einem größeren Problem, da Nutzer dann keine URL mehr auf einer eigenen Zeile einfügen können, um eine Onebox zu erhalten.

Wir würden uns sehr freuen, wenn es eine Möglichkeit gäbe, das fuzzy-Linkify zu deaktivieren, um dieses Problem zu vermeiden, aber gleichzeitig vollständige URLs weiterhin verlinken zu können. Ist das möglich?

Nachfassend… Es sieht so aus, als ob die Änderung der defaultOptions in vendor/assets/javascripts/markdown-it.js, sodass fuzzyLink auf false gesetzt wird, wie von Sam vorgeschlagen, mein Problem löst. Das führt jedoch zu einem großen Ärger, da wir diesen Schritt bei jedem Update nicht manuell wiederholen wollen.

Dann bin ich auf eine einfachere Lösung gestoßen. Die Einstellung markdown linkify tlds ist eine Liste von Top-Level-Domains, die durch das fuzzy linking automatisch als URLs erkannt werden. Wenn Sie alle diese TLDs entfernen und nur eine gefälschte TLD hinzufügen, die niemals in einem Beitrag vorkommen würde, wird fuzzyLink effektiv deaktiviert. Sie benötigen mindestens eine TLD in der Liste, da sonst anscheinend alles, was mit einem . endet, als Link behandelt wird.

Somit ist keine Codeänderung erforderlich. Wir können fuzzyLink deaktivieren, indem wir die echten TLDs aus der Einstellung entfernen und eine gefälschte hinzufügen.

Eine weitere Lösung, um Auto-Verlinkung von Wörtern zu unterdrücken.

Füge <span></span> in der Mitte des Textes ein.


Details

Unsere Website hat SWI-Prolog zur Komponente „Auto-Verlinkung von Wörtern“ im Theme hinzugefügt.

Um zu verhindern, dass SWI-Prolog in einen Link umgewandelt wird, z. B. SWI-Prolog, und gleichzeitig nicht als Codeabschnitt angezeigt wird, z. B. SWI-Prolog, fügt man <span></span> in der Mitte des Textes ein, z. B. SWI<span></span>-Prolog. Dadurch wird der Text von „Auto-Verlinkung von Wörtern“ nicht erkannt. Da <span></span> in etwas gerendert wird, das im Browser nicht sichtbar ist, funktioniert dies im jeweiligen Fall, z. B. bei SWI-Prolog.

Sie können <span></span> verwenden, um den verlinkten Domainnamen zu umschließen, anstatt ihn in der Mitte einzufügen. Das ist nützlich, wenn Sie über Unternehmen und andere Eigennamen mit Punkten im Namen sprechen, wie zum Beispiel itch.io.

Wenn Sie beispielsweise einfach itch.io im Markdown-Editor eingeben, wird es automatisch verlinkt: itch.io

Sie können stattdessen auch <span>itch.io</span> eingeben, und dann wird es nicht verlinkt: itch.io

Sie müssen <span></span> nicht in der Mitte des Links einfügen, wie hier: itch<span></span>.io, aber das funktioniert ebenfalls: itch.io

(Es wäre schön, wenn @precessor oder ein Moderator das Häkchen bei „:white_check_mark: Lösung" auf diese Antwort umstellen könnten, anstatt die aktuell ausgewählte Lösung beizubehalten; die alte Lösung funktionierte 2016 noch, funktioniert aber heute nicht mehr.)

Das ist das Einzige, was mir heute funktioniert hat.

Itch.io


Itch`.`io

Vorformatierung ist auf der Werkzeugleiste und schneller zu verwenden :wink:

Außer dass das das Format ändert, warum sollten Sie das einer Option vorziehen, die das Format nicht ändert?

Denn das Format ist nicht wichtig. Nur das, was Sie bekommen, ist wichtig. Und der Zweck hier ist es, Hyperlinks zu verhindern, und meine Lösung ist immer noch die einfachste. Und die schnellste :wink: