diff --git a/compiler/docgen.nim b/compiler/docgen.nim index 159214e27f..307761409c 100644 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -540,10 +540,11 @@ proc nodeToHighlightedHtml(d: PDoc; n: PNode; result: var string; elif s != nil and s.kind in {skType, skVar, skLet, skConst} and sfExported in s.flags and s.owner != nil and belongsToProjectPackage(d.conf, s.owner) and d.target == outHtml: - let external = externalDep(d, s.owner) - result.addf "$3", - [changeFileExt(external, "html"), literal, - escLit] + let href = (if d.module == s.owner: "" + else: externalDep(d, s.owner).changeFileExt("html") + ) & "#" & literal + result.addf "$2", + [href, escLit] else: dispA(d.conf, result, "$1", "\\spanIdentifier{$1}", [escLit]) diff --git a/nimdoc/extlinks/project/expected/main.html b/nimdoc/extlinks/project/expected/main.html index 1e7c9c1269..2aaf19b3af 100644 --- a/nimdoc/extlinks/project/expected/main.html +++ b/nimdoc/extlinks/project/expected/main.html @@ -99,7 +99,7 @@

Types

-
A = object
+
A = object
diff --git a/nimdoc/extlinks/project/expected/sub/submodule.html b/nimdoc/extlinks/project/expected/sub/submodule.html index 408ce2060f..cd95a9c54e 100644 --- a/nimdoc/extlinks/project/expected/sub/submodule.html +++ b/nimdoc/extlinks/project/expected/sub/submodule.html @@ -88,7 +88,7 @@

Types

-
submoduleInt = distinct int
+
submoduleInt = distinct int
diff --git a/nimdoc/testproject/expected/subdir/subdir_b/utils.html b/nimdoc/testproject/expected/subdir/subdir_b/utils.html index 6decf79a3c..3d994aca66 100644 --- a/nimdoc/testproject/expected/subdir/subdir_b/utils.html +++ b/nimdoc/testproject/expected/subdir/subdir_b/utils.html @@ -257,7 +257,7 @@ Ref. Types
-
G[T] = object
+
G[T] = object
@@ -265,7 +265,7 @@ Ref.
-
SomeType = enum
+  
SomeType = enum
   enumValueA, enumValueB, enumValueC
@@ -281,7 +281,7 @@ Ref.
-
proc `$`[T](a: G[T]): string
+
proc `$`[T](a: G[T]): string
@@ -289,7 +289,7 @@ Ref.
-
proc `$`[T](a: ref SomeType): string
+
proc `$`[T](a: ref SomeType): string
@@ -300,7 +300,7 @@ Ref.
-
func `'big`(a: string): SomeType {....raises: [], tags: [], forbids: [].}
+
func `'big`(a: string): SomeType {....raises: [], tags: [], forbids: [].}
@@ -311,7 +311,7 @@ Ref.
-
proc `[]`[T](x: G[T]): T
+
proc `[]`[T](x: G[T]): T
@@ -322,7 +322,7 @@ Ref.
-
proc `[]=`[T](a: var G[T]; index: int; value: T)
+
proc `[]=`[T](a: var G[T]; index: int; value: T)
@@ -345,7 +345,7 @@ Ref.
-
proc f(x: G[int]) {....raises: [], tags: [], forbids: [].}
+
proc f(x: G[int]) {....raises: [], tags: [], forbids: [].}
There is also variant f(G[string]) @@ -353,7 +353,7 @@ Ref.
-
proc f(x: G[string]) {....raises: [], tags: [], forbids: [].}
+
proc f(x: G[string]) {....raises: [], tags: [], forbids: [].}
See also f(G[int]). @@ -528,7 +528,7 @@ Ref.
-
proc someType(): SomeType {....raises: [], tags: [], forbids: [].}
+
proc someType(): SomeType {....raises: [], tags: [], forbids: [].}
constructor. @@ -545,7 +545,7 @@ Ref.
-
iterator fooBar(a: seq[SomeType]): int {....raises: [], tags: [], forbids: [].}
+
iterator fooBar(a: seq[SomeType]): int {....raises: [], tags: [], forbids: [].}
diff --git a/nimdoc/testproject/expected/testproject.html b/nimdoc/testproject/expected/testproject.html index 62d9911c03..2a5e9aa8a8 100644 --- a/nimdoc/testproject/expected/testproject.html +++ b/nimdoc/testproject/expected/testproject.html @@ -381,7 +381,7 @@

Types

-
A {.inject.} = enum
+  
A {.inject.} = enum
   aA
@@ -390,7 +390,7 @@
-
AnotherObject = object
+  
AnotherObject = object
   case x*: bool
   of true:
     y*: proc (x: string)
@@ -402,7 +402,7 @@
   
-
B {.inject.} = enum
+  
B {.inject.} = enum
   bB
@@ -411,7 +411,7 @@
-
Foo = enum
+  
Foo = enum
   enumValueA2
@@ -420,7 +420,7 @@
-
FooBuzz {....deprecated: "FooBuzz msg".} = int
+
FooBuzz {....deprecated: "FooBuzz msg".} = int
Deprecated: FooBuzz msg @@ -431,7 +431,7 @@
-
MyObject = object
+  
MyObject = object
   someString*: string        ## This is a string
   annotated* {.somePragma.}: string ## This is an annotated string
@@ -441,7 +441,7 @@
-
Shapes = enum
+  
Shapes = enum
   Circle,                   ## A circle
   Triangle,                 ## A three-sided shape
   Rectangle                  ## A four-sided shape
@@ -452,7 +452,7 @@
-
T19396 = object
+  
T19396 = object
   a*: int
@@ -461,7 +461,7 @@
-
Xxx = object
+  
Xxx = object
   field*: int
   field3*: int               ## Doc comment2
@@ -477,7 +477,7 @@

Vars

-
aVariable: array[1, int]
+
aVariable: array[1, int]
@@ -485,7 +485,7 @@
-
someVariable: bool
+
someVariable: bool
This should be visible. @@ -499,7 +499,7 @@

Consts

-
C_A = 0x7FF0000000000000'f64
+
C_A = 0x7FF0000000000000'f64
@@ -507,7 +507,7 @@
-
C_B = 0o377'i8
+
C_B = 0o377'i8
@@ -515,7 +515,7 @@
-
C_C = 0o277'i8
+
C_C = 0o277'i8
@@ -523,7 +523,7 @@
-
C_D = 0o177777'i16
+
C_D = 0o177777'i16
@@ -611,7 +611,7 @@
-
proc bar(f: FooBuzz) {....raises: [], tags: [], forbids: [].}
+
proc bar(f: FooBuzz) {....raises: [], tags: [], forbids: [].}
@@ -835,7 +835,7 @@ at indent 0
-
proc z1(): Foo {....raises: [], tags: [], forbids: [].}
+
proc z1(): Foo {....raises: [], tags: [], forbids: [].}
cz1