diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp
index 8bbdf3e9e88e1e49b26200be47a3b7530c65e8ee..6905483e91a0799482537cadae0c010e10d98058 100644
--- a/src/qdoc/htmlgenerator.cpp
+++ b/src/qdoc/htmlgenerator.cpp
@@ -523,6 +523,11 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark
 
     switch (atom->type()) {
     case Atom::AutoLink:
+        if (relative && relative->name() == atom->string()) {
+            out() << protectEnc(atom->string());
+            break;
+        }
+        Q_FALLTHROUGH();
     case Atom::NavAutoLink:
         if (!inLink_ && !inContents_ && !inSectionHeading_) {
             const Node *node = nullptr;