Score:0

How to avoid converting URLs to links?

cn flag

Using CKeditor5 in Drupal site... is there a way to avoid converting a specific URL to link in a specific page or paragraph? How?

Update: explanation

I have a paragraph where I give the bibtex to copy; one of the entries of the bibtex is an url which has to be presented like in this picture: enter image description here

But CKeditor5 presents it this way:

howpublished = {\href{<a href="http://www.chandia.net/corlexim">http://www.chandia.net/corlexim</a>}{<a href="http://www.chandia.net/corlexim">http://www.chandia.net/corlexim</a>}},

Note that in this explanation I have entered the line as it should be presented but it has been automatically converted to links...

cn flag
I'm pretty sure there's no easy off-the-shelf way to do this. What's the context? Is this a spam link? An internal link that should not be exposed?
Andrés Chandía avatar
cn flag
I'll put context in the question, thanks for bringing that to mind
apaderno avatar
us flag
I cannot reproduce it. On Drupal 10, entering that line in CKEditor5, CKEditor5 shows the source as `<p>howpublished = {\href{http://www.chandia.net/corlexim}{http://www.chandia.net/corlexim}}</p>`. If I enable *Convert URLs into links* URLs are shown as links, but CKEditor5 still shows the source as `<p>howpublished = {\href{http://www.chandia.net/corlexim}{http://www.chandia.net/corlexim}}</p>`.
Andrés Chandía avatar
cn flag
I checked it and you're right, when the text with the url is between <p></p> it remains as it should. My fault, I didn't mention that the text with url is inside <textarea></textarea>, and the one I put in the question above is between <code></code>
Score:3
us flag

I can reproduce this only when the node is using the Full HTML input format an the Convert URLs into links filter is enabled for that input format. In this case, a node that contains <textarea>howpublished = {\href{http://www.chandia.net/corlexim}{http//www.chandia.net/corlexim}}</textarea> is rendered as the following screenshot shows.

screenshot

The only way to avoid that is disabling the Convert URLs into links filter in /admin/config/content/formats/manage/full_html. When I do that, the node is rendered as expected.

screenshot

Andrés Chandía avatar
cn flag
Thanks, you have given me the idea of creating a new text format which have url to link conversion disabled and apply that text format for the page I'm working with...
Andrés Chandía avatar
cn flag
Thanks again @apademo, that did it!!!
Score:0
cn flag

Thanks to @apademo's answer I came up with the idea (actually it is so logically obvious) of creating a new "text format" in Drupal which does not have activated "Convert URLs into links" option, but it has all of the others (or the ones you need) that make it a "Complete Html" format.

Then, I have applied that format to the page where I don't want the urls converted into links...

Obviously, if there is some other URL in the same page that you do want to convert into link, you will have to do it manually:

<a href="https://www.example.com">Manualy Linked URL</a>

Thanks for the answers!

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.