File tree Expand file tree Collapse file tree 4 files changed +20
-5
lines changed
demo-repository/exercises/demo2 Expand file tree Collapse file tree 4 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 1-
2- This exercise is just another demo for the exercise environment.
1+ The following example link will open another tab/window: [ OCaml ] ( https://ocaml.org " External link ")
2+ This exercise is just another demo for the exercise environment.
33<a href =" " onclick =" top .location = ' /exercises/demo/' ;" >Test</a >
44
55<details >
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ depends: [
1717 "base" {>= "v0.9.4"}
1818 "base64"
1919 "cmdliner"
20- "omd"
20+ "omd" {<= "1.3.1"}
2121 "asak"
2222 "cohttp" {>= "1.0.0" & < "2.0.0"}
2323 "cohttp-lwt-unix" {>= "1.0.0" & < "2.0.0"}
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ depends: [
4646 "ocp-ocamlres" {>= "0.4"}
4747 "ocplib-json-typed" {= "0.6"}
4848 "odoc" {build & >= "1.3.0"}
49- "omd"
49+ "omd" {<= "1.3.1"}
5050 "pprint"
5151 "ppx_cstruct"
5252 "ppx_tools"
Original file line number Diff line number Diff line change @@ -317,8 +317,23 @@ module File = struct
317317 descrs := (lang, f raw) :: ! descrs;
318318 return ()
319319 in
320+ let override_url = function
321+ | Omd_representation. Url (href ,s ,title ) ->
322+ if String. length href > 0 then
323+ if Char. equal (String. get href 0 ) '#' then
324+ None
325+ else
326+ let title_url =
327+ if title <> " " then Printf. sprintf {| title= " %s" | } title else " " in
328+ let html =
329+ Printf. sprintf
330+ {|< a href= " %s" target= " _blank" rel= " noopener noreferrer" % s> % s< / a> | }
331+ href title_url (Omd_backend. html_of_md s) in
332+ Some html
333+ else None
334+ | _ -> None in
320335 let markdown_to_html md =
321- Omd. (md |> of_string |> to_html)
336+ Omd. (md |> of_string |> to_html ~override: override_url )
322337 in
323338 let read_descrs () =
324339 let langs = [] in
You can’t perform that action at this time.
0 commit comments