[Git][ghc/ghc][wip/jacco/haddock/codeblock-highlighting] Add haddock tests for codeblock with highlighting
Jacco Krijnen (@jacco)
gitlab at gitlab.haskell.org
Mon Jun 17 18:10:22 UTC 2024
Jacco Krijnen pushed to branch wip/jacco/haddock/codeblock-highlighting at Glasgow Haskell Compiler / GHC
Commits:
bd520bee by Jacco Krijnen at 2024-06-17T20:10:05+02:00
Add haddock tests for codeblock with highlighting
- - - - -
2 changed files:
- + utils/haddock/html-test/ref/CodeblockHighlight2.html
- + utils/haddock/html-test/src/CodeblockHighlight2.hs
Changes:
=====================================
utils/haddock/html-test/ref/CodeblockHighlight2.html
=====================================
@@ -0,0 +1,120 @@
+<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
+ >CodeblockHighlight2</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"
+ >CodeblockHighlight2</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
+ >The following codeblocks start at different indentation in the source, but
+ that should not be visible in the rendered html:</p
+ ><pre class="language-haskell"
+ >add :: Int -> Int -> Int
+add x y = x + y</pre
+ ><pre class="language-haskell"
+ >mul :: Int -> Int -> Int
+mul x y = x * y</pre
+ ><pre class="language-haskell"
+ >pow :: Int -> Int -> Int
+pow 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
+ >The triple backtick notation can also be used without mentioning a language</p
+ ><pre
+ >runghc CodeBlockHighlight2.hs</pre
+ ></div
+ ></div
+ ></div
+ ></div
+ ></body
+ ></html
+>
=====================================
utils/haddock/html-test/src/CodeblockHighlight2.hs
=====================================
@@ -0,0 +1,29 @@
+module CodeblockHighlight2 where
+
+-- | The following codeblocks start at different indentation in the source, but
+-- that should not be visible in the rendered html:
+--
+-- ```haskell
+-- add :: Int -> Int -> Int
+-- add x y = x + y
+-- ```
+--
+-- ```haskell
+-- mul :: Int -> Int -> Int
+-- mul x y = x * y
+-- ```
+--
+--```haskell
+--pow :: Int -> Int -> Int
+--pow x y = x ^ y
+--```
+add :: Int -> Int -> Int
+add x y = x + y
+
+-- | The triple backtick notation can also be used without mentioning a language
+--
+-- ```
+-- runghc CodeBlockHighlight2.hs
+-- ```
+main :: IO ()
+main = putStrLn "Hello, Haskell!"
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/bd520beea77ca0f0dd95d01eab79c846f1fc2be5
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/bd520beea77ca0f0dd95d01eab79c846f1fc2be5
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/5cffbe14/attachment-0001.html>
More information about the ghc-commits
mailing list