Note: You are currently viewing documentation for Moodle 3.7. Up-to-date documentation for the latest stable version of Moodle may be available here: Nolink tags.
At times it is useful to turn off HTML linking. This can be done several ways. One is to use the HTML editor's no linking icon. Another way is to toggle the source code and place a <nolink> </nolink> set of tags directly in the code.
- TIP: New users of Moodle should be careful when using any nolink feature for the first few times. See below.
Tips and Tricks
Joseph Rézeau offered these observation in the Quiz forum:In the prehistory of Moodle we used to have the <nolink></nolink> tag to enclose any portion of HTML which we did not want to be autolinked. This was not very WC3 compliant, so it was replaced (or rather complemented) by <span class="nolink"></span>. That was in my opinion an unfortunate decision; it should have been replaced with a <div class="nolink"></div>, not a span tag. The reason is that a 's scope is too narrow and we often want to enclose a whole block of HTML within a nolink tag, so
So, like you, I keep using the old <nolink></nolink> tag, which in fact still works, provided you do not come back to your HTML text and edit it. If you do, then you have to remove the <span class="nolink"></span>and replace it with <nolink></nolink> (as you found out). I do it all the time and find it pretty irritating. The automatic replacing is due to the HTML editor being over-zealous in its tidying up of the HTML text.
Another solution would be to hack the Moodle code and systematically replace all occurrences of <span class="nolink"></span> with <div class="nolink"></div>. I have done it on my local installation and it works OK.
However, there is another problem. If you have typed some text in the HTML editor and formatted it (e.g. added a few bold or italics, etc. here and there) and then select that formatted text and click on the Prevent automatic linking button in the HTML editor toolbar, you find that all of your formatting is wiped away... You can, of course, re-format your text, but its a loss of time. If you decide that the whole of your text will have to be prevented from automatic linking (as is a frequent requirement in quiz questions), then you should immediately click on the Prevent automatic linking button, before typing anything. If the editor complains that "you must select some text first", then clidk on the body tag at the bottom of the editor (see attached 1) before clicking the Prevent automatic linking button. Then start typing your text, formattting it, etc.