diff --git a/CHANGES.md b/CHANGES.md index ebd6803e16..42b8ceafad 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,8 @@ - Navigation for the search bar : use '/' to enter search, up and down arrows to select a result, and enter to follow the selected link. (@EmileTrotignon, #1088) - OCaml 5.2.0 compatibility (@Octachron, #1094) +- Added a class to distinguish external and internal links in the html output + (@panglesd, #767) ### Changed diff --git a/src/html/generator.ml b/src/html/generator.ml index 1322fd38de..afacaa9cfa 100644 --- a/src/html/generator.ml +++ b/src/html/generator.ml @@ -143,7 +143,10 @@ and inline ~config ?(emph_level = 0) ~resolve (l : Inline.t) : let content = inline_nolink ~emph_level c in [ Html.span ~a content ] | Link (href, c) -> - let a = (a :> Html_types.a_attrib Html.attrib list) in + let a = + (class_ ("external-link" :: t.attr) + :> Html_types.a_attrib Html.attrib list) + in let content = inline_nolink ~emph_level c in [ Html.a ~a:(Html.a_href href :: a) content ] | InternalLink c -> internallink ~config ~emph_level ~resolve ~a c diff --git a/test/generators/html/Bugs.html b/test/generators/html/Bugs.html index 50e7220735..9220d385d4 100644 --- a/test/generators/html/Bugs.html +++ b/test/generators/html/Bugs.html @@ -34,8 +34,8 @@

Module Bugs

Triggers an assertion failure when - - https://github.com/ocaml/odoc/issues/101 + https://github.com/ocaml/odoc/issues/101 is not fixed.

diff --git a/test/generators/html/Markup.html b/test/generators/html/Markup.html index 056e53af61..f463937bc1 100644 --- a/test/generators/html/Markup.html +++ b/test/generators/html/Markup.html @@ -103,7 +103,7 @@
italics. It also work the same in - links in italics with + links in italics with emphasis in emphasis. @@ -126,16 +126,20 @@
-

This is a link. It sends you to the top of this - page. Links can have markup inside them: bold - , italics, emphasis - , superscript, - subscript, and - code. Links can also be nested - inside markup. Links cannot be nested inside - each other. This link has no replacement text: # - . The text is filled in by odoc. This is a shorthand link: - #. The text is also filled in by odoc in this case. +

This is a link. It sends + you to the top of this page. Links can have markup inside them: + bold, + italics, + emphasis, + superscript, + subscript, and + code. Links can + also be nested inside + markup. Links cannot be nested inside each other. This link has + no replacement text: #. The + text is filled in by odoc. This is a shorthand link: + #. The text is also filled + in by odoc in this case.

This is a reference to foo. References can have replacement text: @@ -307,7 +311,7 @@

Math