From e01e4790402204af02ab0127ef5b633fb7748cd4 Mon Sep 17 00:00:00 2001 From: Dominic Steinitz Date: Sat, 16 May 2015 12:32:23 +0100 Subject: Handle inline math with mathjax. --- haddock-api/src/Haddock/Backends/Hoogle.hs | 2 ++ haddock-api/src/Haddock/Backends/LaTeX.hs | 3 +++ haddock-api/src/Haddock/Backends/Xhtml.hs | 1 + haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs | 2 ++ 4 files changed, 8 insertions(+) (limited to 'haddock-api/src/Haddock/Backends') diff --git a/haddock-api/src/Haddock/Backends/Hoogle.hs b/haddock-api/src/Haddock/Backends/Hoogle.hs index a9bc9a8b..8d67bd45 100644 --- a/haddock-api/src/Haddock/Backends/Hoogle.hs +++ b/haddock-api/src/Haddock/Backends/Hoogle.hs @@ -308,6 +308,8 @@ markupTag dflags = Markup { markupBold = box (TagInline "b"), markupMonospaced = box (TagInline "tt"), markupPic = const $ str " ", + -- FIXME: We could actually emit the mathjax as it is moderately readable + markupMathInline = const $ str "", markupUnorderedList = box (TagL 'u'), markupOrderedList = box (TagL 'o'), markupDefList = box (TagL 'u') . map (\(a,b) -> TagInline "i" a : Str " " : b), diff --git a/haddock-api/src/Haddock/Backends/LaTeX.hs b/haddock-api/src/Haddock/Backends/LaTeX.hs index ab6bb41c..34aca327 100644 --- a/haddock-api/src/Haddock/Backends/LaTeX.hs +++ b/haddock-api/src/Haddock/Backends/LaTeX.hs @@ -1107,6 +1107,7 @@ parLatexMarkup ppId = Markup { markupMonospaced = \p _ -> tt (p Mono), markupUnorderedList = \p v -> itemizedList (map ($v) p) $$ text "", markupPic = \p _ -> markupPic p, + markupMathInline = \p _ -> markupMathInline p, markupOrderedList = \p v -> enumeratedList (map ($v) p) $$ text "", markupDefList = \l v -> descriptionList (map (\(a,b) -> (a v, b v)) l), markupCodeBlock = \p _ -> quote (verb (p Verb)) $$ text "", @@ -1139,6 +1140,8 @@ parLatexMarkup ppId = Markup { beg = text "image: " <> text uri + markupMathInline mathjax = text "$" <> text mathjax <> text "$" + markupId ppId_ id v = case v of Verb -> theid diff --git a/haddock-api/src/Haddock/Backends/Xhtml.hs b/haddock-api/src/Haddock/Backends/Xhtml.hs index 1554a33c..89772441 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml.hs @@ -114,6 +114,7 @@ headHtml docTitle miniPage themes = thetitle << docTitle, styleSheet themes, script ! [src jsFile, thetype "text/javascript"] << noHtml, + script ! [src "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML", thetype "text/javascript"] << noHtml, script ! [thetype "text/javascript"] -- NB: Within XHTML, the content of script tags needs to be -- a section. Will break if the miniPage name could diff --git a/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs b/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs index 3fe74a82..b291af0b 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs @@ -33,6 +33,7 @@ import Data.Maybe (fromMaybe) import GHC import Name + parHtmlMarkup :: Qualification -> Bool -> (Bool -> a -> Html) -> DocMarkup a Html parHtmlMarkup qual insertAnchors ppId = Markup { @@ -67,6 +68,7 @@ parHtmlMarkup qual insertAnchors ppId = Markup { then namedAnchor aname << "" else noHtml, markupPic = \(Picture uri t) -> image ! ([src uri] ++ fromMaybe [] (return . title <$> t)), + markupMathInline = \mathjax -> toHtml ("\\(" ++ mathjax ++ "\\)"), markupProperty = pre . toHtml, markupExample = examplesToHtml, markupHeader = \(Header l t) -> makeHeader l t -- cgit v1.2.3 From 3f50b955324bd4b42f88a421f0203bc46a3ccf64 Mon Sep 17 00:00:00 2001 From: Dominic Steinitz <dominic@steinitz.org> Date: Sat, 16 May 2015 13:53:14 +0100 Subject: Fix the documentation for haddock itself. Change notation and add support for inline math. Allow newlines in display math. Add a command line option for the mathjax url (you might want to use a locally installed version). Rebase tests because of extra url and version change. Respond to (some of the) comments. Fix warnings in InterfaceFile.hs --- haddock-api/src/Haddock.hs | 5 +++-- haddock-api/src/Haddock/Backends/Hoogle.hs | 2 +- haddock-api/src/Haddock/Backends/LaTeX.hs | 5 ++++- haddock-api/src/Haddock/Backends/Xhtml.hs | 25 ++++++++++++---------- .../src/Haddock/Backends/Xhtml/DocMarkup.hs | 1 + haddock-api/src/Haddock/Interface/LexParseRn.hs | 1 + haddock-api/src/Haddock/InterfaceFile.hs | 13 ++++++++++- haddock-api/src/Haddock/Options.hs | 7 ++++++ haddock-api/src/Haddock/Types.hs | 3 ++- haddock-api/src/Haddock/Utils.hs | 2 ++ .../src/Documentation/Haddock/Parser.hs | 24 +++++++++++++-------- haddock-library/src/Documentation/Haddock/Types.hs | 1 + .../test/Documentation/Haddock/ParserSpec.hs | 4 ++++ html-test/ref/Bug387.html | 2 ++ html-test/ref/Math.html | 22 ++++++++++++++++++- html-test/ref/mini_A.html | 2 ++ html-test/ref/mini_AdvanceTypes.html | 2 ++ html-test/ref/mini_B.html | 2 ++ html-test/ref/mini_Bug1.html | 2 ++ html-test/ref/mini_Bug2.html | 2 ++ html-test/ref/mini_Bug3.html | 2 ++ html-test/ref/mini_Bug4.html | 2 ++ html-test/ref/mini_Bug6.html | 2 ++ html-test/ref/mini_Bug7.html | 2 ++ html-test/ref/mini_Bug8.html | 2 ++ html-test/ref/mini_BugDeprecated.html | 2 ++ html-test/ref/mini_BugExportHeadings.html | 2 ++ html-test/ref/mini_Bugs.html | 2 ++ html-test/ref/mini_DeprecatedClass.html | 2 ++ html-test/ref/mini_DeprecatedData.html | 2 ++ html-test/ref/mini_DeprecatedFunction.html | 2 ++ html-test/ref/mini_DeprecatedFunction2.html | 2 ++ html-test/ref/mini_DeprecatedFunction3.html | 2 ++ html-test/ref/mini_DeprecatedModule.html | 2 ++ html-test/ref/mini_DeprecatedModule2.html | 2 ++ html-test/ref/mini_DeprecatedNewtype.html | 2 ++ html-test/ref/mini_DeprecatedReExport.html | 2 ++ html-test/ref/mini_DeprecatedRecord.html | 2 ++ html-test/ref/mini_DeprecatedTypeFamily.html | 2 ++ html-test/ref/mini_DeprecatedTypeSynonym.html | 2 ++ html-test/ref/mini_Examples.html | 2 ++ html-test/ref/mini_FunArgs.html | 2 ++ html-test/ref/mini_GADTRecords.html | 2 ++ html-test/ref/mini_Hash.html | 2 ++ html-test/ref/mini_HiddenInstances.html | 2 ++ html-test/ref/mini_HiddenInstancesB.html | 2 ++ html-test/ref/mini_Hyperlinks.html | 2 ++ html-test/ref/mini_IgnoreExports.html | 2 ++ html-test/ref/mini_Math.html | 2 ++ html-test/ref/mini_ModuleWithWarning.html | 2 ++ html-test/ref/mini_NamedDoc.html | 2 ++ html-test/ref/mini_NoLayout.html | 2 ++ html-test/ref/mini_NonGreedy.html | 2 ++ html-test/ref/mini_Properties.html | 2 ++ html-test/ref/mini_PruneWithWarning.html | 2 ++ html-test/ref/mini_QuasiExpr.html | 2 ++ html-test/ref/mini_QuasiQuote.html | 2 ++ .../ref/mini_SpuriousSuperclassConstraints.html | 2 ++ html-test/ref/mini_TH.html | 2 ++ html-test/ref/mini_TH2.html | 2 ++ html-test/ref/mini_Test.html | 2 ++ html-test/ref/mini_Ticket112.html | 2 ++ html-test/ref/mini_Ticket61.html | 2 ++ html-test/ref/mini_Ticket75.html | 2 ++ html-test/ref/mini_TitledPicture.html | 2 ++ html-test/ref/mini_TypeFamilies.html | 2 ++ html-test/ref/mini_TypeOperators.html | 2 ++ html-test/ref/mini_Unicode.html | 2 ++ html-test/ref/mini_Visible.html | 2 ++ html-test/src/Math.hs | 12 ++++++++++- 70 files changed, 209 insertions(+), 28 deletions(-) (limited to 'haddock-api/src/Haddock/Backends') diff --git a/haddock-api/src/Haddock.hs b/haddock-api/src/Haddock.hs index 70cdf8a3..72a6cc92 100644 --- a/haddock-api/src/Haddock.hs +++ b/haddock-api/src/Haddock.hs @@ -247,6 +247,7 @@ render dflags flags qual ifaces installedIfaces extSrcMap = do odir = outputDir flags opt_latex_style = optLaTeXStyle flags opt_source_css = optSourceCssFile flags + opt_mathjax = optMathjax flags visibleIfaces = [ i | i <- ifaces, OptHide `notElem` ifaceOptions i ] @@ -297,7 +298,7 @@ render dflags flags qual ifaces installedIfaces extSrcMap = do when (Flag_GenContents `elem` flags) $ do ppHtmlContents dflags odir title pkgStr - themes opt_index_url sourceUrls' opt_wiki_urls + themes opt_mathjax opt_index_url sourceUrls' opt_wiki_urls allVisibleIfaces True prologue pretty (makeContentsQual qual) copyHtmlBits odir libDir themes @@ -305,7 +306,7 @@ render dflags flags qual ifaces installedIfaces extSrcMap = do when (Flag_Html `elem` flags) $ do ppHtml dflags title pkgStr visibleIfaces odir prologue - themes sourceUrls' opt_wiki_urls + themes opt_mathjax sourceUrls' opt_wiki_urls opt_contents_url opt_index_url unicode qual pretty copyHtmlBits odir libDir themes diff --git a/haddock-api/src/Haddock/Backends/Hoogle.hs b/haddock-api/src/Haddock/Backends/Hoogle.hs index 8d67bd45..97709d78 100644 --- a/haddock-api/src/Haddock/Backends/Hoogle.hs +++ b/haddock-api/src/Haddock/Backends/Hoogle.hs @@ -308,8 +308,8 @@ markupTag dflags = Markup { markupBold = box (TagInline "b"), markupMonospaced = box (TagInline "tt"), markupPic = const $ str " ", - -- FIXME: We could actually emit the mathjax as it is moderately readable markupMathInline = const $ str "<math>", + markupMathDisplay = const $ str "<math>", markupUnorderedList = box (TagL 'u'), markupOrderedList = box (TagL 'o'), markupDefList = box (TagL 'u') . map (\(a,b) -> TagInline "i" a : Str " " : b), diff --git a/haddock-api/src/Haddock/Backends/LaTeX.hs b/haddock-api/src/Haddock/Backends/LaTeX.hs index 34aca327..e30c768a 100644 --- a/haddock-api/src/Haddock/Backends/LaTeX.hs +++ b/haddock-api/src/Haddock/Backends/LaTeX.hs @@ -1108,6 +1108,7 @@ parLatexMarkup ppId = Markup { markupUnorderedList = \p v -> itemizedList (map ($v) p) $$ text "", markupPic = \p _ -> markupPic p, markupMathInline = \p _ -> markupMathInline p, + markupMathDisplay = \p _ -> markupMathDisplay p, markupOrderedList = \p v -> enumeratedList (map ($v) p) $$ text "", markupDefList = \l v -> descriptionList (map (\(a,b) -> (a v, b v)) l), markupCodeBlock = \p _ -> quote (verb (p Verb)) $$ text "", @@ -1140,7 +1141,9 @@ parLatexMarkup ppId = Markup { beg = text "image: " <> text uri - markupMathInline mathjax = text "$" <> text mathjax <> text "$" + markupMathInline mathjax = text "\\(" <> text mathjax <> text "\\)" + + markupMathDisplay mathjax = text "\\[" <> text mathjax <> text "\\]" markupId ppId_ id v = case v of diff --git a/haddock-api/src/Haddock/Backends/Xhtml.hs b/haddock-api/src/Haddock/Backends/Xhtml.hs index 89772441..cf53c27e 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml.hs @@ -63,6 +63,7 @@ ppHtml :: DynFlags -> FilePath -- ^ Destination directory -> Maybe (MDoc GHC.RdrName) -- ^ Prologue text, maybe -> Themes -- ^ Themes + -> Maybe String -- ^ The mathjax URL (--mathjax) -> SourceURLs -- ^ The source URL (--source) -> WikiURLs -- ^ The wiki URL (--wiki) -> Maybe String -- ^ The contents URL (--use-contents) @@ -73,7 +74,7 @@ ppHtml :: DynFlags -> IO () ppHtml dflags doctitle maybe_package ifaces odir prologue - themes maybe_source_url maybe_wiki_url + themes maybe_mathjax_url maybe_source_url maybe_wiki_url maybe_contents_url maybe_index_url unicode qual debug = do let @@ -82,7 +83,7 @@ ppHtml dflags doctitle maybe_package ifaces odir prologue when (isNothing maybe_contents_url) $ ppHtmlContents dflags odir doctitle maybe_package - themes maybe_index_url maybe_source_url maybe_wiki_url + themes maybe_mathjax_url maybe_index_url maybe_source_url maybe_wiki_url (map toInstalledIface visible_ifaces) False -- we don't want to display the packages in a single-package contents prologue debug (makeContentsQual qual) @@ -107,14 +108,14 @@ copyHtmlBits odir libdir themes = do mapM_ copyLibFile [ jsFile, framesFile ] -headHtml :: String -> Maybe String -> Themes -> Html -headHtml docTitle miniPage themes = +headHtml :: String -> Maybe String -> Themes -> Maybe String -> Html +headHtml docTitle miniPage themes mathjax_url = header << [ meta ! [httpequiv "Content-Type", content "text/html; charset=UTF-8"], thetitle << docTitle, styleSheet themes, script ! [src jsFile, thetype "text/javascript"] << noHtml, - script ! [src "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML", thetype "text/javascript"] << noHtml, + script ! [src mjUrl, thetype "text/javascript"] << noHtml, script ! [thetype "text/javascript"] -- NB: Within XHTML, the content of script tags needs to be -- a <![CDATA[ section. Will break if the miniPage name could @@ -125,6 +126,7 @@ headHtml docTitle miniPage themes = ] where setSynopsis = maybe "" (\p -> "setSynopsis(\"" ++ p ++ "\");") miniPage + mjUrl = maybe "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" id mathjax_url srcButton :: SourceURLs -> Maybe Interface -> Maybe Html @@ -243,6 +245,7 @@ ppHtmlContents -> Maybe String -> Themes -> Maybe String + -> Maybe String -> SourceURLs -> WikiURLs -> [InstalledInterface] -> Bool -> Maybe (MDoc GHC.RdrName) @@ -250,12 +253,12 @@ ppHtmlContents -> Qualification -- ^ How to qualify names -> IO () ppHtmlContents dflags odir doctitle _maybe_package - themes maybe_index_url + themes mathjax_url maybe_index_url maybe_source_url maybe_wiki_url ifaces showPkgs prologue debug qual = do let tree = mkModuleTree dflags showPkgs [(instMod iface, toInstalledDescription iface) | iface <- ifaces] html = - headHtml doctitle Nothing themes +++ + headHtml doctitle Nothing themes mathjax_url +++ bodyHtml doctitle Nothing maybe_source_url maybe_wiki_url Nothing maybe_index_url << [ @@ -344,7 +347,7 @@ ppHtmlContentsFrame :: FilePath -> String -> Themes ppHtmlContentsFrame odir doctitle themes ifaces debug = do let mods = flatModuleTree ifaces html = - headHtml doctitle Nothing themes +++ + headHtml doctitle Nothing themes Nothing +++ miniBody << divModuleList << (sectionName << "Modules" +++ ulist << [ li ! [theclass "module"] << m | m <- mods ]) @@ -384,7 +387,7 @@ ppHtmlIndex odir doctitle _maybe_package themes where indexPage showLetters ch items = - headHtml (doctitle ++ " (" ++ indexName ch ++ ")") Nothing themes +++ + headHtml (doctitle ++ " (" ++ indexName ch ++ ")") Nothing themes Nothing +++ bodyHtml doctitle Nothing maybe_source_url maybe_wiki_url maybe_contents_url Nothing << [ @@ -496,7 +499,7 @@ ppHtmlModule odir doctitle themes mdl_str = moduleString mdl real_qual = makeModuleQual qual aliases mdl html = - headHtml mdl_str (Just $ "mini_" ++ moduleHtmlFile mdl) themes +++ + headHtml mdl_str (Just $ "mini_" ++ moduleHtmlFile mdl) themes Nothing +++ bodyHtml doctitle (Just iface) maybe_source_url maybe_wiki_url maybe_contents_url maybe_index_url << [ @@ -513,7 +516,7 @@ ppHtmlModuleMiniSynopsis :: FilePath -> String -> Themes ppHtmlModuleMiniSynopsis odir _doctitle themes iface unicode qual debug = do let mdl = ifaceMod iface html = - headHtml (moduleString mdl) Nothing themes +++ + headHtml (moduleString mdl) Nothing themes Nothing +++ miniBody << (divModuleHeader << sectionName << moduleString mdl +++ miniSynopsis mdl iface unicode qual) diff --git a/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs b/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs index b291af0b..e36f9528 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs @@ -69,6 +69,7 @@ parHtmlMarkup qual insertAnchors ppId = Markup { else noHtml, markupPic = \(Picture uri t) -> image ! ([src uri] ++ fromMaybe [] (return . title <$> t)), markupMathInline = \mathjax -> toHtml ("\\(" ++ mathjax ++ "\\)"), + markupMathDisplay = \mathjax -> toHtml ("\\[" ++ mathjax ++ "\\]"), markupProperty = pre . toHtml, markupExample = examplesToHtml, markupHeader = \(Header l t) -> makeHeader l t diff --git a/haddock-api/src/Haddock/Interface/LexParseRn.hs b/haddock-api/src/Haddock/Interface/LexParseRn.hs index 87bfa9e2..4f6b2c09 100644 --- a/haddock-api/src/Haddock/Interface/LexParseRn.hs +++ b/haddock-api/src/Haddock/Interface/LexParseRn.hs @@ -133,6 +133,7 @@ rename dflags gre = rn DocHyperlink l -> DocHyperlink l DocPic str -> DocPic str DocMathInline str -> DocMathInline str + DocMathDisplay str -> DocMathDisplay str DocAName str -> DocAName str DocProperty p -> DocProperty p DocExamples e -> DocExamples e diff --git a/haddock-api/src/Haddock/InterfaceFile.hs b/haddock-api/src/Haddock/InterfaceFile.hs index 73185092..12fa5a93 100644 --- a/haddock-api/src/Haddock/InterfaceFile.hs +++ b/haddock-api/src/Haddock/InterfaceFile.hs @@ -473,7 +473,6 @@ instance (Binary mod, Binary id) => Binary (MetaDoc mod id) where d <- get bh return $ MetaDoc { _meta = m, _doc = d } -{-* Generated by DrIFT : Look, but Don't Touch. *-} instance (Binary mod, Binary id) => Binary (DocH mod id) where put_ bh DocEmpty = do putByte bh 0 @@ -538,6 +537,12 @@ instance (Binary mod, Binary id) => Binary (DocH mod id) where put_ bh (DocHeader aa) = do putByte bh 20 put_ bh aa + put_ bh (DocMathInline x) = do + putByte bh 21 + put_ bh x + put_ bh (DocMathDisplay x) = do + putByte bh 22 + put_ bh x get bh = do h <- getByte bh @@ -605,6 +610,12 @@ instance (Binary mod, Binary id) => Binary (DocH mod id) where 20 -> do aa <- get bh return (DocHeader aa) + 21 -> do + x <- get bh + return (DocMathInline x) + 22 -> do + x <- get bh + return (DocMathDisplay x) _ -> error "invalid binary data found in the interface file" diff --git a/haddock-api/src/Haddock/Options.hs b/haddock-api/src/Haddock/Options.hs index f84989ef..0449c829 100644 --- a/haddock-api/src/Haddock/Options.hs +++ b/haddock-api/src/Haddock/Options.hs @@ -26,6 +26,7 @@ module Haddock.Options ( wikiUrls, optDumpInterfaceFile, optLaTeXStyle, + optMathjax, qualification, verbosity, ghcFlags, @@ -69,6 +70,7 @@ data Flag | Flag_LaTeXStyle String | Flag_HyperlinkedSource | Flag_SourceCss String + | Flag_Mathjax String | Flag_Help | Flag_Verbosity String | Flag_Version @@ -116,6 +118,7 @@ options backwardsCompat = "output in HTML (XHTML 1.0)", Option [] ["latex"] (NoArg Flag_LaTeX) "use experimental LaTeX rendering", Option [] ["latex-style"] (ReqArg Flag_LaTeXStyle "FILE") "provide your own LaTeX style in FILE", + Option [] ["mathjax"] (ReqArg Flag_Mathjax "URL") "URL FOR mathjax", Option ['U'] ["use-unicode"] (NoArg Flag_UseUnicode) "use Unicode in HTML output", Option [] ["hoogle"] (NoArg Flag_Hoogle) "output for Hoogle; you may want --package-name and --package-version too", @@ -272,6 +275,10 @@ optLaTeXStyle :: [Flag] -> Maybe String optLaTeXStyle flags = optLast [ str | Flag_LaTeXStyle str <- flags ] +optMathjax :: [Flag] -> Maybe String +optMathjax flags = optLast [ str | Flag_Mathjax str <- flags ] + + qualification :: [Flag] -> Either String QualOption qualification flags = case map (map Char.toLower) [ str | Flag_Qualification str <- flags ] of diff --git a/haddock-api/src/Haddock/Types.hs b/haddock-api/src/Haddock/Types.hs index 41826bfc..bf178c24 100644 --- a/haddock-api/src/Haddock/Types.hs +++ b/haddock-api/src/Haddock/Types.hs @@ -442,6 +442,7 @@ instance (NFData a, NFData mod) DocHyperlink a -> a `deepseq` () DocPic a -> a `deepseq` () DocMathInline a -> a `deepseq` () + DocMathDisplay a -> a `deepseq` () DocAName a -> a `deepseq` () DocProperty a -> a `deepseq` () DocExamples a -> a `deepseq` () @@ -490,6 +491,7 @@ data DocMarkup id a = Markup , markupAName :: String -> a , markupPic :: Picture -> a , markupMathInline :: String -> a + , markupMathDisplay :: String -> a , markupProperty :: String -> a , markupExample :: [Example] -> a , markupHeader :: Header a -> a @@ -528,7 +530,6 @@ emptyHaddockModInfo = HaddockModInfo ----------------------------------------------------------------------------- -{-! for DocOption derive: Binary !-} -- | Source-level options for controlling the documentation. data DocOption = OptHide -- ^ This module should not appear in the docs. diff --git a/haddock-api/src/Haddock/Utils.hs b/haddock-api/src/Haddock/Utils.hs index 0704f1ef..325dd710 100644 --- a/haddock-api/src/Haddock/Utils.hs +++ b/haddock-api/src/Haddock/Utils.hs @@ -479,6 +479,7 @@ markup m (DocHyperlink l) = markupHyperlink m l markup m (DocAName ref) = markupAName m ref markup m (DocPic img) = markupPic m img markup m (DocMathInline mathjax) = markupMathInline m mathjax +markup m (DocMathDisplay mathjax) = markupMathDisplay m mathjax markup m (DocProperty p) = markupProperty m p markup m (DocExamples e) = markupExample m e markup m (DocHeader (Header l t)) = markupHeader m (Header l (markup m t)) @@ -510,6 +511,7 @@ idMarkup = Markup { markupAName = DocAName, markupPic = DocPic, markupMathInline = DocMathInline, + markupMathDisplay = DocMathDisplay, markupProperty = DocProperty, markupExample = DocExamples, markupHeader = DocHeader diff --git a/haddock-library/src/Documentation/Haddock/Parser.hs b/haddock-library/src/Documentation/Haddock/Parser.hs index 919ea37f..123f5612 100644 --- a/haddock-library/src/Documentation/Haddock/Parser.hs +++ b/haddock-library/src/Documentation/Haddock/Parser.hs @@ -74,6 +74,7 @@ overIdentifier f d = g d g (DocHyperlink x) = DocHyperlink x g (DocPic x) = DocPic x g (DocMathInline x) = DocMathInline x + g (DocMathDisplay x) = DocMathDisplay x g (DocAName x) = DocAName x g (DocProperty x) = DocProperty x g (DocExamples x) = DocExamples x @@ -114,7 +115,8 @@ parseStringBS = snd . parse p where p :: Parser (DocH mod Identifier) p = docConcat <$> many (monospace <|> anchor <|> identifier <|> moduleName - <|> picture <|> mathDisplay <|> markdownImage + <|> picture <|> mathDisplay <|> mathInline + <|> markdownImage <|> hyperlink <|> bold <|> emphasis <|> encodedChar <|> string' <|> skipSpecialChar) @@ -226,17 +228,21 @@ picture :: Parser (DocH mod a) picture = DocPic . makeLabeled Picture . decodeUtf8 <$> disallowNewline ("<<" *> takeUntil ">>") --- FIXME: I have just copied the code for `picture` but it is not --- clear why we should disallow a newline (if that is what --- `disallowNewline` does) +-- | Inline math parser, surrounded by \\( and \\). +-- +-- >>> parseString "\\(\\int_{-\\infty}^{\\infty} e^{-x^2/2} = \\sqrt{2\\pi}\\)" +-- DocMathInline "\\int_{-\\infty}^{\\infty} e^{-x^2/2} = \\sqrt{2\\pi}" +mathInline :: Parser (DocH mod a) +mathInline = DocMathInline . decodeUtf8 + <$> disallowNewline ("\\(" *> takeUntil "\\)") --- | Inline math parser, surrounded by \$\$ and \$\$. +-- | Display math parser, surrounded by \\[ and \\]. -- --- >>> parseString "$$\int_{-infty}^{infty} e^{-x^2/2} = \sqrt{2\pi}$$" --- DocMathInline (DocString "\int_{-infty}^{infty} e^{-x^2/2} = \sqrt{2\pi}") +-- >>> parseString "\\[\\int_{-\\infty}^{\\infty} e^{-x^2/2} = \\sqrt{2\\pi}\\]" +-- DocMathDisplay "\\int_{-\\infty}^{\\infty} e^{-x^2/2} = \\sqrt{2\\pi}" mathDisplay :: Parser (DocH mod a) -mathDisplay = DocMathInline . decodeUtf8 - <$> disallowNewline ("$$" *> takeUntil "$$") +mathDisplay = DocMathDisplay . decodeUtf8 + <$> ("\\[" *> takeUntil "\\]") markdownImage :: Parser (DocH mod a) markdownImage = fromHyperlink <$> ("!" *> linkParser) diff --git a/haddock-library/src/Documentation/Haddock/Types.hs b/haddock-library/src/Documentation/Haddock/Types.hs index 2b1e7f26..4d5bb68a 100644 --- a/haddock-library/src/Documentation/Haddock/Types.hs +++ b/haddock-library/src/Documentation/Haddock/Types.hs @@ -72,6 +72,7 @@ data DocH mod id | DocHyperlink Hyperlink | DocPic Picture | DocMathInline String + | DocMathDisplay String | DocAName String | DocProperty String | DocExamples [Example] diff --git a/haddock-library/test/Documentation/Haddock/ParserSpec.hs b/haddock-library/test/Documentation/Haddock/ParserSpec.hs index 2ef414fb..1169eb49 100644 --- a/haddock-library/test/Documentation/Haddock/ParserSpec.hs +++ b/haddock-library/test/Documentation/Haddock/ParserSpec.hs @@ -208,6 +208,10 @@ spec = do it "supports title for deprecated picture syntax" $ do "<<b a z>>" `shouldParseTo` image "b" "a z" + context "when parsing display math" $ do + + it "accepts markdown syntax for display math containing newlines" $ do + "\\[\\pi\n\\pi\\]" `shouldParseTo` DocMathDisplay "\\pi\n\\pi" context "when parsing anchors" $ do it "parses a single word anchor" $ do diff --git a/html-test/ref/Bug387.html b/html-test/ref/Bug387.html index 7b605fd0..80735916 100644 --- a/html-test/ref/Bug387.html +++ b/html-test/ref/Bug387.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();setSynopsis("mini_Bug387.html");}; diff --git a/html-test/ref/Math.html b/html-test/ref/Math.html index 3335f7b1..5b76fd13 100644 --- a/html-test/ref/Math.html +++ b/html-test/ref/Math.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();setSynopsis("mini_Math.html");}; @@ -41,6 +43,22 @@ window.onload = function () {pageLoad();setSynopsis("mini_Math.html");}; ><p class="caption" >Math</p ></div + ><div id="description" + ><p class="caption" + >Description</p + ><div class="doc" + ><p + >Math (display) for <code + >normalDensity</code + ></p + ><p + >\[ + \int_{-\infty}^{\infty} e^{-x^2/2} = \sqrt{2\pi} + \]</p + ><p + >\(\int_{-\infty}^{\infty} e^{-x^2/2} = \sqrt{2\pi}\)</p + ></div + ></div ><div id="synopsis" ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" >Synopsis</p @@ -67,7 +85,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_Math.html");}; ><p >Math (inline) for <code >normalDensity</code - > $$\int_{-\infnty}^{\infty} e^{-x^2/2} = sqrt{2\pi}$$</p + > + \(\int_{-\infty}^{\infty} e^{-x^2/2} = \sqrt{2\pi}\) + \[\int_{-\infty}^{\infty} e^{-x^2/2} = \sqrt{2\pi}\]</p ></div ></div ></div diff --git a/html-test/ref/mini_A.html b/html-test/ref/mini_A.html index c3d36935..6f914440 100644 --- a/html-test/ref/mini_A.html +++ b/html-test/ref/mini_A.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_AdvanceTypes.html b/html-test/ref/mini_AdvanceTypes.html index c4b0806a..f72502dd 100644 --- a/html-test/ref/mini_AdvanceTypes.html +++ b/html-test/ref/mini_AdvanceTypes.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_B.html b/html-test/ref/mini_B.html index 9b3ef381..557d5dfe 100644 --- a/html-test/ref/mini_B.html +++ b/html-test/ref/mini_B.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_Bug1.html b/html-test/ref/mini_Bug1.html index bab3748c..01a65c6f 100644 --- a/html-test/ref/mini_Bug1.html +++ b/html-test/ref/mini_Bug1.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_Bug2.html b/html-test/ref/mini_Bug2.html index b673e459..4cbea53d 100644 --- a/html-test/ref/mini_Bug2.html +++ b/html-test/ref/mini_Bug2.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_Bug3.html b/html-test/ref/mini_Bug3.html index af4cc445..9f46a9e6 100644 --- a/html-test/ref/mini_Bug3.html +++ b/html-test/ref/mini_Bug3.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_Bug4.html b/html-test/ref/mini_Bug4.html index b403e94a..cfc489b4 100644 --- a/html-test/ref/mini_Bug4.html +++ b/html-test/ref/mini_Bug4.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_Bug6.html b/html-test/ref/mini_Bug6.html index e448e7a3..cea7a09d 100644 --- a/html-test/ref/mini_Bug6.html +++ b/html-test/ref/mini_Bug6.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_Bug7.html b/html-test/ref/mini_Bug7.html index 2cb7ebe1..3c32e012 100644 --- a/html-test/ref/mini_Bug7.html +++ b/html-test/ref/mini_Bug7.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_Bug8.html b/html-test/ref/mini_Bug8.html index ca6ec68a..63770a6d 100644 --- a/html-test/ref/mini_Bug8.html +++ b/html-test/ref/mini_Bug8.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_BugDeprecated.html b/html-test/ref/mini_BugDeprecated.html index 9c8fc229..5a075ca8 100644 --- a/html-test/ref/mini_BugDeprecated.html +++ b/html-test/ref/mini_BugDeprecated.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_BugExportHeadings.html b/html-test/ref/mini_BugExportHeadings.html index e170b41a..2a1223e6 100644 --- a/html-test/ref/mini_BugExportHeadings.html +++ b/html-test/ref/mini_BugExportHeadings.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_Bugs.html b/html-test/ref/mini_Bugs.html index 3c758375..6c7eefe7 100644 --- a/html-test/ref/mini_Bugs.html +++ b/html-test/ref/mini_Bugs.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_DeprecatedClass.html b/html-test/ref/mini_DeprecatedClass.html index 3923c1ff..05889033 100644 --- a/html-test/ref/mini_DeprecatedClass.html +++ b/html-test/ref/mini_DeprecatedClass.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_DeprecatedData.html b/html-test/ref/mini_DeprecatedData.html index 7f11afeb..6dad3417 100644 --- a/html-test/ref/mini_DeprecatedData.html +++ b/html-test/ref/mini_DeprecatedData.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_DeprecatedFunction.html b/html-test/ref/mini_DeprecatedFunction.html index 9bb90dac..1564c916 100644 --- a/html-test/ref/mini_DeprecatedFunction.html +++ b/html-test/ref/mini_DeprecatedFunction.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_DeprecatedFunction2.html b/html-test/ref/mini_DeprecatedFunction2.html index a03991a9..8af6fa90 100644 --- a/html-test/ref/mini_DeprecatedFunction2.html +++ b/html-test/ref/mini_DeprecatedFunction2.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_DeprecatedFunction3.html b/html-test/ref/mini_DeprecatedFunction3.html index 4ea60339..61819fc8 100644 --- a/html-test/ref/mini_DeprecatedFunction3.html +++ b/html-test/ref/mini_DeprecatedFunction3.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_DeprecatedModule.html b/html-test/ref/mini_DeprecatedModule.html index bfdef611..112d70df 100644 --- a/html-test/ref/mini_DeprecatedModule.html +++ b/html-test/ref/mini_DeprecatedModule.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_DeprecatedModule2.html b/html-test/ref/mini_DeprecatedModule2.html index dbcc43b9..18dc9b2d 100644 --- a/html-test/ref/mini_DeprecatedModule2.html +++ b/html-test/ref/mini_DeprecatedModule2.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_DeprecatedNewtype.html b/html-test/ref/mini_DeprecatedNewtype.html index 84d41828..22b56d10 100644 --- a/html-test/ref/mini_DeprecatedNewtype.html +++ b/html-test/ref/mini_DeprecatedNewtype.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_DeprecatedReExport.html b/html-test/ref/mini_DeprecatedReExport.html index 405926b1..b1600cb7 100644 --- a/html-test/ref/mini_DeprecatedReExport.html +++ b/html-test/ref/mini_DeprecatedReExport.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_DeprecatedRecord.html b/html-test/ref/mini_DeprecatedRecord.html index 54dc9722..5da974e7 100644 --- a/html-test/ref/mini_DeprecatedRecord.html +++ b/html-test/ref/mini_DeprecatedRecord.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_DeprecatedTypeFamily.html b/html-test/ref/mini_DeprecatedTypeFamily.html index c87d9637..eb90e152 100644 --- a/html-test/ref/mini_DeprecatedTypeFamily.html +++ b/html-test/ref/mini_DeprecatedTypeFamily.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_DeprecatedTypeSynonym.html b/html-test/ref/mini_DeprecatedTypeSynonym.html index c04c374f..4ea068d9 100644 --- a/html-test/ref/mini_DeprecatedTypeSynonym.html +++ b/html-test/ref/mini_DeprecatedTypeSynonym.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_Examples.html b/html-test/ref/mini_Examples.html index c99c2c48..16769ed2 100644 --- a/html-test/ref/mini_Examples.html +++ b/html-test/ref/mini_Examples.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_FunArgs.html b/html-test/ref/mini_FunArgs.html index eac6c8fe..952e6879 100644 --- a/html-test/ref/mini_FunArgs.html +++ b/html-test/ref/mini_FunArgs.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_GADTRecords.html b/html-test/ref/mini_GADTRecords.html index a8b838f0..fe0c5753 100644 --- a/html-test/ref/mini_GADTRecords.html +++ b/html-test/ref/mini_GADTRecords.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_Hash.html b/html-test/ref/mini_Hash.html index a0a68840..6647caf7 100644 --- a/html-test/ref/mini_Hash.html +++ b/html-test/ref/mini_Hash.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_HiddenInstances.html b/html-test/ref/mini_HiddenInstances.html index 01bab320..5e709de7 100644 --- a/html-test/ref/mini_HiddenInstances.html +++ b/html-test/ref/mini_HiddenInstances.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_HiddenInstancesB.html b/html-test/ref/mini_HiddenInstancesB.html index e02b42b1..8c8b832c 100644 --- a/html-test/ref/mini_HiddenInstancesB.html +++ b/html-test/ref/mini_HiddenInstancesB.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_Hyperlinks.html b/html-test/ref/mini_Hyperlinks.html index f0c7d65a..5071b876 100644 --- a/html-test/ref/mini_Hyperlinks.html +++ b/html-test/ref/mini_Hyperlinks.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_IgnoreExports.html b/html-test/ref/mini_IgnoreExports.html index a420e65a..498b8507 100644 --- a/html-test/ref/mini_IgnoreExports.html +++ b/html-test/ref/mini_IgnoreExports.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_Math.html b/html-test/ref/mini_Math.html index 92786b95..e7f0f14f 100644 --- a/html-test/ref/mini_Math.html +++ b/html-test/ref/mini_Math.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_ModuleWithWarning.html b/html-test/ref/mini_ModuleWithWarning.html index 19315a14..ebe78e11 100644 --- a/html-test/ref/mini_ModuleWithWarning.html +++ b/html-test/ref/mini_ModuleWithWarning.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_NamedDoc.html b/html-test/ref/mini_NamedDoc.html index 066bbc61..58ba3f53 100644 --- a/html-test/ref/mini_NamedDoc.html +++ b/html-test/ref/mini_NamedDoc.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_NoLayout.html b/html-test/ref/mini_NoLayout.html index 19562d70..74878965 100644 --- a/html-test/ref/mini_NoLayout.html +++ b/html-test/ref/mini_NoLayout.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_NonGreedy.html b/html-test/ref/mini_NonGreedy.html index 698c368e..96c51c75 100644 --- a/html-test/ref/mini_NonGreedy.html +++ b/html-test/ref/mini_NonGreedy.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_Properties.html b/html-test/ref/mini_Properties.html index 5f538dfd..8362d16e 100644 --- a/html-test/ref/mini_Properties.html +++ b/html-test/ref/mini_Properties.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_PruneWithWarning.html b/html-test/ref/mini_PruneWithWarning.html index 9eb3aa00..e73dc510 100644 --- a/html-test/ref/mini_PruneWithWarning.html +++ b/html-test/ref/mini_PruneWithWarning.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_QuasiExpr.html b/html-test/ref/mini_QuasiExpr.html index 06797498..f9e8b7b5 100644 --- a/html-test/ref/mini_QuasiExpr.html +++ b/html-test/ref/mini_QuasiExpr.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_QuasiQuote.html b/html-test/ref/mini_QuasiQuote.html index 5dac6acc..e0d8e22e 100644 --- a/html-test/ref/mini_QuasiQuote.html +++ b/html-test/ref/mini_QuasiQuote.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_SpuriousSuperclassConstraints.html b/html-test/ref/mini_SpuriousSuperclassConstraints.html index 22079a4e..38be01c4 100644 --- a/html-test/ref/mini_SpuriousSuperclassConstraints.html +++ b/html-test/ref/mini_SpuriousSuperclassConstraints.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_TH.html b/html-test/ref/mini_TH.html index d2ddbabc..51b35ee5 100644 --- a/html-test/ref/mini_TH.html +++ b/html-test/ref/mini_TH.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_TH2.html b/html-test/ref/mini_TH2.html index 2c9f1340..767e6e2c 100644 --- a/html-test/ref/mini_TH2.html +++ b/html-test/ref/mini_TH2.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_Test.html b/html-test/ref/mini_Test.html index 7453387c..3fd26035 100644 --- a/html-test/ref/mini_Test.html +++ b/html-test/ref/mini_Test.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_Ticket112.html b/html-test/ref/mini_Ticket112.html index 68a0a5e5..d6f23ea2 100644 --- a/html-test/ref/mini_Ticket112.html +++ b/html-test/ref/mini_Ticket112.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_Ticket61.html b/html-test/ref/mini_Ticket61.html index a73fefca..6c061b7e 100644 --- a/html-test/ref/mini_Ticket61.html +++ b/html-test/ref/mini_Ticket61.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_Ticket75.html b/html-test/ref/mini_Ticket75.html index 75ce882c..351a4d16 100644 --- a/html-test/ref/mini_Ticket75.html +++ b/html-test/ref/mini_Ticket75.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_TitledPicture.html b/html-test/ref/mini_TitledPicture.html index 760566e5..91f61ef3 100644 --- a/html-test/ref/mini_TitledPicture.html +++ b/html-test/ref/mini_TitledPicture.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_TypeFamilies.html b/html-test/ref/mini_TypeFamilies.html index feb61abc..9c6e02ea 100644 --- a/html-test/ref/mini_TypeFamilies.html +++ b/html-test/ref/mini_TypeFamilies.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_TypeOperators.html b/html-test/ref/mini_TypeOperators.html index ce31643e..61a01103 100644 --- a/html-test/ref/mini_TypeOperators.html +++ b/html-test/ref/mini_TypeOperators.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_Unicode.html b/html-test/ref/mini_Unicode.html index 55336980..820cd80d 100644 --- a/html-test/ref/mini_Unicode.html +++ b/html-test/ref/mini_Unicode.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/ref/mini_Visible.html b/html-test/ref/mini_Visible.html index 976a30c5..d51d755a 100644 --- a/html-test/ref/mini_Visible.html +++ b/html-test/ref/mini_Visible.html @@ -7,6 +7,8 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script + ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script ><script type="text/javascript" >//<![CDATA[ window.onload = function () {pageLoad();}; diff --git a/html-test/src/Math.hs b/html-test/src/Math.hs index aa6ff1ff..75bc513e 100644 --- a/html-test/src/Math.hs +++ b/html-test/src/Math.hs @@ -1,4 +1,14 @@ +-- | Math (display) for 'normalDensity' +-- +-- \[ +-- \int_{-\infty}^{\infty} e^{-x^2/2} = \sqrt{2\pi} +-- \] +-- +-- \(\int_{-\infty}^{\infty} e^{-x^2/2} = \sqrt{2\pi}\) + module Math where --- | Math (inline) for 'normalDensity' $$\int_{-\infty}^{\infty} e^{-x^2/2} = \sqrt{2\pi}$$ +-- | Math (inline) for 'normalDensity' +-- \(\int_{-\infty}^{\infty} e^{-x^2/2} = \sqrt{2\pi}\) +-- \[\int_{-\infty}^{\infty} e^{-x^2/2} = \sqrt{2\pi}\] f = 5 -- cgit v1.2.3