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?

1 „Gefällt mir“

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

7 „Gefällt mir“

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

4 „Gefällt mir“

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 commonmark.org/help

1 „Gefällt mir“

Because it’s not code?

3 „Gefällt mir“

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?”

3 „Gefällt mir“

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:

2 „Gefällt mir“

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

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

2 „Gefällt mir“

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.

3 „Gefällt mir“

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)

1 „Gefällt mir“

The main purpose of our forum is talking about a company called Alarm.com so people write Alarm.com in posts all the time, probably in 50% or so of topics. We’re going to end up unintentionally linking to Alarm.com an awful lot.

I tried disabling linkify all together but that causes a bigger problem because then people can’t put a URL on a line by itself to get a onebox.

We would love a way to disable linkify fuzzy to avoid this problem but still be able to linkify full URLs. Is it possible?

1 „Gefällt mir“

Following up… It looks like if you change the defaultOptions in vendor/assets/javascripts/markdown-it.js so that fuzzyLink is false, as Sam suggested, it solves my problem. But doing so creates a big headache because we don’t want to manually redo that change every time we update.

Then I stumbled on a simpler solution. The markdown linkify tlds setting is a list of top level domains that are assumed to be URLs by fuzzy linking. If you remove all those TLDs and add just one fake TLD that would never actually show up in a post then it effectively disables fuzzyLink. You need at least one TLD in the list or apparently anything that ends with a . will be treated as a link.

So no need for a code change, we can disable fuzzyLink my removing the real TLDs from the setting and adding a fake one.

5 „Gefällt mir“

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.

3 „Gefällt mir“

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.)

5 „Gefällt mir“

Das ist das Einzige, was mir heute funktioniert hat.

1 „Gefällt mir“

Itch.io


Itch`.`io

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

1 „Gefällt mir“

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

1 „Gefällt mir“

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:

1 „Gefällt mir“

Dieses Thema wurde nach 2942 Tagen automatisch geschlossen. Neue Antworten sind nicht mehr möglich.