# Distinguish links converted from raw text and made using formatting

**URL:** https://meta.discourse.org/t/distinguish-links-converted-from-raw-text-and-made-using-formatting/77503
**Category:** Feature
**Created:** [January 8, 2018, 7:21pm UTC](https://meta.discourse.org/t/distinguish-links-converted-from-raw-text-and-made-using-formatting/77503 "2018-01-08T19:21:28Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![jooize](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jooize/32/537063_2.png) [@jooize](https://meta.discourse.org/u/jooize)
#### Post date: [January 8, 2018, 7:21pm UTC](https://meta.discourse.org/t/distinguish-links-converted-from-raw-text-and-made-using-formatting/77503/1 "2018-01-08T19:21:28Z")

</div>

Links can be misleading and potentially an attack vector.

[https://discourse.org](https://meta.discourse.org)

That links goes to [meta.discourse.org](http://meta.discourse.org), but you wouldn’t know without checking first.

Discourse could indicate when a link is converted from raw text as the second link or made using formatting as the first. I have not considered how to do that. Perhaps underdotting for raw text links, or the other way around.

There’s the idea anyhow.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 8, 2018, 7:34pm UTC](https://meta.discourse.org/t/distinguish-links-converted-from-raw-text-and-made-using-formatting/77503/2 "2018-01-08T19:34:57Z")

</div>

This is true for every link on the web. You can mouse-over a link to see where it’s going to go.

---

<div class="post-metadata">

### Author: ![jooize](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jooize/32/537063_2.png) [@jooize](https://meta.discourse.org/u/jooize)
#### Post date: [January 8, 2018, 7:49pm UTC](https://meta.discourse.org/t/distinguish-links-converted-from-raw-text-and-made-using-formatting/77503/3 "2018-01-08T19:49:03Z")

</div>

Yes, of course, but we can mostly avoid the issue in every Discourse forum. Trust remains in the administrators. I’m saying it might be worthwhile to resolve the issue with all regular posters.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [January 9, 2018, 2:32am UTC](https://meta.discourse.org/t/distinguish-links-converted-from-raw-text-and-made-using-formatting/77503/4 "2018-01-09T02:32:16Z")

</div>

There is an existing discussion on a plugin to warn on all external links (not a fan) or warn on known bad links as vetted by google safe browsing service — which is a much better idea.

---

<div class="post-metadata">

### Author: ![jooize](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jooize/32/537063_2.png) [@jooize](https://meta.discourse.org/u/jooize)
#### Post date: [January 9, 2018, 2:56am UTC](https://meta.discourse.org/t/distinguish-links-converted-from-raw-text-and-made-using-formatting/77503/5 "2018-01-09T02:56:09Z")

</div>

I don’t want to clutter the interface too much either. Working with cryptocurrencies where a wallet was found to be reachable by any website via JavaScript made me think of this. Known bad links will always lag behind.

If only formatted links including an url scheme would be indicated as possibly misleading, but it’s probably a rabbit hole of targetting all creative workarounds.

Cheers

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [January 9, 2018, 5:04am UTC](https://meta.discourse.org/t/distinguish-links-converted-from-raw-text-and-made-using-formatting/77503/6 "2018-01-09T05:04:31Z")

</div>

If I’m understanding, you want to distinguish between

```html
<a href="http://example.com">http://example.com</a> 
<a href="http://example.com">some text</a>

```

where the “some text” is _not_ the href value.

I think a short amount of JavaScript working with the cooked could style them differently.

EDIT  
As a proof of concept, this works for me on my localhost in Customize `</body>`

```plaintext
 $(document).on("ajaxComplete", function( event ) {
  let post_links = document.body.querySelectorAll(".contents .cooked a:not(.back):not(.mention)");
  let i = 0;
  for (i = 0; i < post_links.length; i++) {
      if ( post_links[i].href != post_links[i].textContent ) {
          post_links[i].style.outline = "1px solid #900";
      }
  }
});

```
