[Git][ghc/ghc][wip/jacco/haddock/codeblock-highlighting] Add golden test for codeblocks with highlighting

Jacco Krijnen (@jacco) gitlab at gitlab.haskell.org
Mon Jun 17 17:11:34 UTC 2024



Jacco Krijnen pushed to branch wip/jacco/haddock/codeblock-highlighting at Glasgow Haskell Compiler / GHC


Commits:
b9abfee5 by Jacco Krijnen at 2024-06-17T19:11:22+02:00
Add golden test for codeblocks with highlighting

- - - - -


2 changed files:

- + utils/haddock/html-test/ref/CodeblockHighlight.html
- + utils/haddock/html-test/src/CodeblockHighlight.hs


Changes:

=====================================
utils/haddock/html-test/ref/CodeblockHighlight.html
=====================================
@@ -0,0 +1,115 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+><head
+  ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
+     /><meta name="viewport" content="width=device-width, initial-scale=1"
+     /><title
+    >CodeblockHighlight</title
+    ><link href="#" rel="stylesheet" type="text/css" title="Linuwial"
+     /><link rel="stylesheet" type="text/css" href="#"
+     /><link rel="stylesheet" type="text/css" href="#"
+     /><script src="haddock-bundle.min.js" async="async" type="text/javascript"
+    ></script
+    ><script type="text/x-mathjax-config"
+    >MathJax.Hub.Config({ tex2jax: { processClass: "mathjax", ignoreClass: ".*" } });</script
+    ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"
+    ></script
+    ></head
+  ><body
+  ><div id="package-header"
+    ><span class="caption empty"
+      > </span
+      ><ul class="links" id="page-menu"
+      ><li
+	><a href="#"
+	  >Contents</a
+	  ></li
+	><li
+	><a href="#"
+	  >Index</a
+	  ></li
+	></ul
+      ></div
+    ><div id="content"
+    ><div id="module-header"
+      ><table class="info"
+	><tr
+	  ><th
+	    >Safe Haskell</th
+	    ><td
+	    >None</td
+	    ></tr
+	  ></table
+	><p class="caption"
+	>CodeblockHighlight</p
+	></div
+      ><div id="synopsis"
+      ><details id="syn"
+	><summary
+	  >Synopsis</summary
+	  ><ul class="details-toggle" data-details-id="syn"
+	  ><li class="src short"
+	    ><a href="#"
+	      >add</a
+	      > :: <a href="#" title="Data.Int"
+	      >Int</a
+	      > -> <a href="#" title="Data.Int"
+	      >Int</a
+	      > -> <a href="#" title="Data.Int"
+	      >Int</a
+	      ></li
+	    ><li class="src short"
+	    ><a href="#"
+	      >main</a
+	      > :: <a href="#" title="Prelude"
+	      >IO</a
+	      > ()</li
+	    ></ul
+	  ></details
+	></div
+      ><div id="interface"
+      ><h1
+	>Documentation</h1
+	><div class="top"
+	><p class="src"
+	  ><a id="v:add" class="def"
+	    >add</a
+	    > :: <a href="#" title="Data.Int"
+	    >Int</a
+	    > -> <a href="#" title="Data.Int"
+	    >Int</a
+	    > -> <a href="#" title="Data.Int"
+	    >Int</a
+	    > <a href="#" class="selflink"
+	    >#</a
+	    ></p
+	  ><div class="doc"
+	  ><p
+	    >A simple function that adds two integers.</p
+	    ><p
+	    >Its implementation is straightforward:</p
+	    ><pre class="language-haskell"
+	    >add :: Int -> Int -> Int
+add x y = x + y</pre
+	    ></div
+	  ></div
+	><div class="top"
+	><p class="src"
+	  ><a id="v:main" class="def"
+	    >main</a
+	    > :: <a href="#" title="Prelude"
+	    >IO</a
+	    > () <a href="#" class="selflink"
+	    >#</a
+	    ></p
+	  ><div class="doc"
+	  ><p
+	    >Run this program as follows:</p
+	    ><pre class="language-bash"
+	    >runghc CodeBlockHighlight.hs</pre
+	    ></div
+	  ></div
+	></div
+      ></div
+    ></body
+  ></html
+>


=====================================
utils/haddock/html-test/src/CodeblockHighlight.hs
=====================================
@@ -0,0 +1,20 @@
+module CodeblockHighlight where
+
+-- | A simple function that adds two integers.
+--
+-- Its implementation is straightforward:
+--
+-- ```haskell
+-- add :: Int -> Int -> Int
+-- add x y = x + y
+-- ```
+add :: Int -> Int -> Int
+add x y = x + y
+
+-- | Run this program as follows:
+--
+-- ```bash
+-- runghc CodeBlockHighlight.hs
+-- ```
+main :: IO ()
+main = putStrLn "Hello, Haskell!"



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b9abfee529ec0301910560e11b9d4e57b7beecc3

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b9abfee529ec0301910560e11b9d4e57b7beecc3
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240617/f112712a/attachment-0001.html>


More information about the ghc-commits mailing list