ハイパーリンクを防止する

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)

当フォーラムの主な目的は、Alarm.com という会社について議論することです。そのため、投稿ではほぼ半分のトピックで「Alarm.com」という文字が頻繁に使用されます。その結果、Alarm.com へのリンクが意図せず大量に生成されてしまいます。

リンク化(linkify)を完全に無効にしようと試みましたが、それでは URL を単独の行に記述してワンボックス表示させることができないため、より大きな問題が発生してしまいました。

この問題を回避しつつ、完全な URL についてはリンク化を維持したいと考えています。そのために「linkify fuzzy」のみを無効にする方法があれば幸いです。可能でしょうか?

フォローアップです。Sam が提案したように、vendor/assets/javascripts/markdown-it.js 内の defaultOptionsfuzzyLinkfalse に設定すると、私の問題が解決するようです。しかし、そうすると毎回アップデートのたびに手動でその変更をやり直す必要があり、大きな頭痛の種になります。

その後、よりシンプルな解決策を見つけました。markdown linkify tlds 設定は、ファジーリンクによって URL とみなされるトップレベルドメイン(TLD)のリストです。このリストからすべての TLD を削除し、投稿に絶対に現れないような偽の TLD を 1 つだけ追加すれば、実質的に fuzzyLink を無効化できます。リストには少なくとも 1 つの TLD が必要で、そうでないと、. で終わるものがすべてリンクとして扱われてしまうようです。

つまり、コードの変更は不要で、設定から実在の TLD を削除して偽の TLD を追加することで fuzzyLink を無効化できます。

Auto linkify wordsを無効にする別の回避策。

テキストの中央に \u003cspan\u003e\u003c/span\u003e を追加します。


詳細

当サイトでは、Auto linkify words コンポーネントテーマに SWI-Prolog が追加されています。

SWI-PrologSWI-Prolog のようなリンクに変換されたり、SWI-Prolog のようなコードセクションとして表示されたりしないようにするため、テキストの中央に \u003cspan\u003e\u003c/span\u003e を追加します(例:SWI\u003cspan\u003e\u003c/span\u003e-Prolog)。これにより、Auto linkify words によってテキストが認識されなくなります。また、\u003cspan\u003e\u003c/span\u003e はブラウザ上では表示されないようにレンダリングされるため、特定のケース(例:SWI-Prolog)で必要な動作を実現できます。

リンク化されたドメインを中央に挿入するのではなく、\u003cspan\u003e\u003c/span\u003e で囲むことができます。これは、itch.io のようにドットを含む会社名や固有名詞について言及する場合に便利です。

例えば、Markdown エディタで itch.io と入力するだけで、以下のようにリンク化されます: itch.io

しかし、\u003cspan\u003eitch.io\u003c/span\u003e と入力すれば、リンク化されません: \u003cspan\u003eitch.io\u003c/span\u003e

リンクの中央に \u003cspan\u003e\u003c/span\u003e を挿入する必要はありません(例: itch\u003cspan\u003e\u003c/span\u003e.io)が、この方法でも機能します: itch\u003cspan\u003e\u003c/span\u003e.io

@precessor またはモデレーターが、現在選択されている解決策ではなく、この回答に「:white_check_mark: 解決済み」のチェックを変更してくださると嬉しいです。以前の解決策は 2016 年には機能していましたが、現在は機能しません。)

今日、これが唯一私に効いたことです。

Itch.io


Itch`.`io

プリフォーマットはツールバーにあり、使用が速いです :wink:

フォーマットが変わってしまうので、フォーマットを変えないオプションがあるのに、なぜそちらではなくそちらを選びたいのですか?

フォーマットは重要ではないからです。重要なのは、あなたが何を得るかだけです。そして、ここでの目的はハイパーリンクを防ぐことであり、私の解決策は依然として最も簡単で、最も速いものです :wink: