TryGhost / Ghost

Independent technology for modern publishing, memberships, subscriptions and newsletters.
https://ghost.org
MIT License
47.02k stars 10.23k forks source link

Markdown for url without hyperlink #9566

Closed wmthor closed 6 years ago

wmthor commented 6 years ago

Is there a way to add urls in the markdown editor without the automatically generated hyperlink? I was surprised to find out that urls were automatically converted to hyperlinks and can't find a way to remove them except for this hack that sort of solves it.

[http://www.url-here-instead.com]()

I would think there needs to be a way to remove the automatically generated hyperlinks, or have it documented if there is. Or perhaps another solution would be to remove the automatically generated hyperlink, as if an author wanted the link they would explicitly specify it with the markdown.

kevinansfield commented 6 years ago

Hey @wmthor 👋 I'm interested to hear the use case for displaying a full URL that isn't hyperlinked. The only way to avoid full URLs (eg, URLs starting with http:// or https://) being converted to hyperlinks in the markdown editor is to not start them with http(s):// or to wrap them in HTML, eg:

example.com won't be linked because it's not a URL

<div style="display: inline">http://example.com</div> won't be linked because it's inside HTML

I'm going to close this issue because it's the expected behaviour and would be a breaking change if the behaviour was modified. Our new rich-text Koenig editor is currently in development, that won't automatically link URLs because it makes linking text easier than it is in markdown.

wmthor commented 6 years ago

Hi, @kevinansfield. Thanks for the response. The div solution works. I understand that changing it drastically would break a lot of things and not worth implementing for such a specific use case. I found that inline code worked as another workaround. Thanks.

ghost commented 5 years ago

I had the same problem, after much research I was able to solve using the following method.

Desativar links automáticos do Markdown

lazarevzubov commented 5 years ago

@kevinansfield I don't think that it is an expected behavior in ALL cases. For example, it isn't for an inlined code: Screenshot 2019-06-20 at 10 45 09 Moreover, a hyperlink is automatically generated even if the text link doesn't contain "http" at the beginning. And this one can't be worked around neither by adding HTML tags, nor by []() MD syntax.

I suggest re-opening the issue.

kevinansfield commented 5 years ago

@lazarevzubov it looks like you're on an old version of Ghost or you have something else in your environment that is auto-linking the URL. Testing this in Ghost 2.x the URL is not auto linked when using a code card, or inside a code block when using a markdown card

lazarevzubov commented 5 years ago

@kevinansfield Thanks for your reply! I'm actually on Ghost 2.23.4 and Ghost-CLI 1.11.0. Used theme – Casper 2.10.2 + Disqus. Nothing else is in related environment is installed as far as I know!

dnlgrgly commented 5 years ago

Hey guys! 👋 I am having the very same issue, and it's very annoying. As I am trying to parse JSON from the Ghost frontend's API response, it breaks because instead of "href": "url", I get "href": "<a href="url">url</a>, breaking the parsing process. Is there any workaround or fix @wmthor?

wmthor commented 5 years ago

There doesn't seem to be any real fix for it, and the only way is a workaround. For your case, the simplest workaround might be to usehttps<span>://</span>www.github.com, and then do a string replace <span>://</span> to :// in your JSON parser.

kevinansfield commented 5 years ago

This is starting to sound like it's a completely different issue and I'm not able to reproduce at all.

Could someone experiencing problems please open a new issue and include full details of what's happening? A screencast would be most useful because the descriptions of the issue so far are difficult to follow. Thanks!

ghost commented 5 years ago

Hello, I do not know if it will be the problem of all, my bog also generated the automatic links, after a while I discovered that was related to the comments of Disqus, I even make a post with Pt-Br about the solution here. https://www.insideblock.com/blog/desativar-links-automaticos-do-markdown-com-jekyll.html

hbragman commented 5 years ago

It is a problem! I have to describe a configfile, and simple values like camel.springboot.name gets formatted like a link. Very frustrating. It is inside a table using | | |

hbragman commented 5 years ago

linkMarkDown

dazlin1 commented 4 years ago

I am having the same problem when trying to put a URL into a fenced code block. It is automatically turned into a link. HTML isn't any good here. There must be a solution.

xamarinermanoj commented 3 years ago

There is. Use & # 46 ; (without the spaces) to represent "." character.

dinaayoub commented 3 years ago

To answer the question on the use case, it's for documentation purposes - for example, on our API i want to instruct people to insert certain information into the URL. e.g. begin the actual game 'https://latte-blackjack.herokuapp.com/next/{dealerid}'

I don't want them to be able to click that because it won't work. they have to remove {dealerid} and replace it with the uuid our API provides them.

mdcramer commented 2 years ago

Here's a use case: About.com is a defunct website, so on https://mdcramer.github.io/rank-dynamics/welcome/ I'd prefer that it not automatically hyperlink and send a click to some random website.

I tried using the &-solution above, but it's still linking. (Oddly, it doesn't get auto-linked when I put the markdown into https://stackedit.io.) Following advice from https://stackoverflow.com/a/25707855/852795, I used "About.com" and that did the trick!

That being said, it would be nice to have an easy way to prevent markdown from automatically creating hyperlinks where they are not wanted.

Mugane commented 1 year ago

There is. Use & # 46 ; (without the spaces) to represent "." character.

It gets parsed as a link as if you just used a period.