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)
الغرض الرئيسي من منتدانا هو الحديث عن شركة تُدعى Alarm.com، لذا يكتب المستخدمون اسم Alarm.com في المنشورات طوال الوقت، ربما في حوالي 50% من المواضيع. سننتهي بحكم الأمر الواقع بربط محتوى الشركة بشكل غير مقصود بشكل كبير.
لقد حاولت تعطيل ميزة تحويل الروابط (linkify) بالكامل، لكن ذلك يسبب مشكلة أكبر لأن المستخدمين لن يتمكنوا بعد ذلك من وضع رابط URL على سطر بمفرده للحصول على ملخص (onebox).
نود جدًا وجود طريقة لتعطيل ميزة تحويل الروابط الضبابية (linkify fuzzy) لتجنب هذه المشكلة مع الحفاظ على القدرة على تحويل الروابط الكاملة (full URLs) إلى روابط نشطة. هل هذا ممكن؟
متابعة… يبدو أنه إذا قمت بتغيير defaultOptions في vendor/assets/javascripts/markdown-it.js بحيث تكون قيمة fuzzyLink هي false، كما اقترح سام، فإن ذلك يحل مشكلتي. لكن القيام بذلك يخلق مشكلة كبيرة لأننا لا نريد إعادة تنفيذ هذا التغيير يدويًا في كل مرة نقوم فيها بالتحديث.
ثم عثرت على حل أبسط. إعداد markdown linkify tlds هو قائمة بالنطاقات العليا (TLDs) التي يُفترض أنها عناوين URL عبر الربط الضبابي. إذا قمت بإزالة جميع هذه النطاقات العليا وإضافة نطاق علوي وهمي واحد فقط من غير المحتمل أن يظهر فعليًا في منشور، فإن ذلك يعطل وظيفة fuzzyLink فعليًا. يجب أن يكون هناك نطاق علوي واحد على الأقل في القائمة، وإلا فإن أي شيء ينتهي بـ . سيتم معالجته كروابط.
لذا، لا حاجة لتغيير في الكود؛ يمكننا تعطيل fuzzyLink بإزالة النطاقات العليا الحقيقية من الإعداد وإضافة نطاق وهمي واحد.
أضف <span></span> في منتصف النص.
التفاصيل
موقعنا يحتوي على SWI-Prolog مُضافًا إلى مكون “ربط الكلمات تلقائيًا” في السمة.
ولمنع تحويل SWI-Prolog إلى رابط، مثل SWI-Prolog، وكذلك لعدم عرضه كقسم كود، مثل SWI-Prolog، فإن إضافة <span></span> في منتصف النص، مثل SWI<span></span>-Prolog، تجعل النص غير معترف به من قِبَل “ربط الكلمات تلقائيًا”. وبما أن <span></span> يتم تصييره إلى شيء لا يظهر في المتصفح، فإن هذا الحل يعمل كما هو مطلوب في الحالة المحددة، مثل SWI-Prolog.
يمكنك استخدام <span></span> لتغليف النطاق المحوَّل إلى رابط، بدلاً من إدراجه في المنتصف. وهذا مفيد عند الحديث عن الشركات والأسماء الصحيحة الأخرى التي تحتوي على نقاط في أسماءها، مثل itch.io.
على سبيل المثال، إذا كتبت فقط itch.io في محرر Markdown، فسيتم تحويله إلى رابط: itch.io
ولكن يمكنك بدلاً من ذلك كتابة <span>itch.io</span>، ولن يتم تحويله إلى رابط: itch.io
لا يلزم إدراج <span></span> في منتصف الرابط، كما في هذا المثال itch<span></span>.io، لكن هذا يعمل أيضاً: itch.io
(سيكون من الجميل إذا قام @precessor أو أحد المشرفين بتغيير علامة التحقق “ الحل” إلى هذه الإجابة بدلاً من الحل المحدد حالياً؛ فقد كان الحل القديم يعمل في عام 2016، لكنه لم يعد يعمل اليوم.)