diff --git a/src/IHaskell/Flags.hs b/src/IHaskell/Flags.hs index f9ae5030..cdd91a2e 100644 --- a/src/IHaskell/Flags.hs +++ b/src/IHaskell/Flags.hs @@ -140,8 +140,8 @@ kernelCodeMirrorFlag = flagReq ["codemirror"] (store CodeMirror) "" "Specify codemirror mode that is used for syntax highlighting (default: ihaskell)." kernelHtmlCodeWrapperClassFlag :: Flag Args -kernelHtmlCodeWrapperClassFlag = flagReq ["html-code-wrapper-class"] (store HtmlCodeWrapperClass) "cm-s-jupyter" - "Specify class name for wrapper div around HTML output (default: cm-s-jupyter)" +kernelHtmlCodeWrapperClassFlag = flagReq ["html-code-wrapper-class"] (store HtmlCodeWrapperClass) "CodeMirror cm-s-jupyter cm-s-ipython" + "Specify class name for wrapper div around HTML output (default: 'CodeMirror cm-s-jupyter cm-s-ipython')" kernelHtmlCodeTokenPrefixFlag :: Flag Args kernelHtmlCodeTokenPrefixFlag = flagReq ["html-code-token-prefix"] (store HtmlCodeTokenPrefix) "cm-" diff --git a/src/IHaskell/IPython.hs b/src/IHaskell/IPython.hs index c3662d6f..2fb04b13 100644 --- a/src/IHaskell/IPython.hs +++ b/src/IHaskell/IPython.hs @@ -57,7 +57,7 @@ defaultKernelSpecOptions = KernelSpecOptions -- multithreading on two processors. , kernelSpecDebug = False , kernelSpecCodeMirror = "ihaskell" - , kernelSpecHtmlCodeWrapperClass = Just "cm-s-jupyter" + , kernelSpecHtmlCodeWrapperClass = Just "CodeMirror cm-s-jupyter cm-s-ipython" , kernelSpecHtmlCodeTokenPrefix = "cm-" , kernelSpecConfFile = defaultConfFile , kernelSpecInstallPrefix = Nothing diff --git a/src/IHaskell/Types.hs b/src/IHaskell/Types.hs index 5f161690..33cb2623 100644 --- a/src/IHaskell/Types.hs +++ b/src/IHaskell/Types.hs @@ -205,7 +205,7 @@ defaultKernelState = KernelState , openComms = mempty , kernelDebug = False , supportLibrariesAvailable = True - , htmlCodeWrapperClass = Just "cm-s-jupyter" + , htmlCodeWrapperClass = Just "CodeMirror cm-s-jupyter cm-s-ipython" , htmlCodeTokenPrefix = "cm-" } diff --git a/src/tests/IHaskell/Test/Eval.hs b/src/tests/IHaskell/Test/Eval.hs index af40148c..a533cf3a 100644 --- a/src/tests/IHaskell/Test/Eval.hs +++ b/src/tests/IHaskell/Test/Eval.hs @@ -187,7 +187,7 @@ testEval = (displays, output) <- eval ":in String" displays `shouldBe` [ManyDisplay [Display [ DisplayData PlainText "type String :: *\ntype String = [Char]\n \t-- Defined in \8216GHC.Base\8217" - , DisplayData MimeHtml "
type String :: *
\ntype String = [Char]
\t
-- Defined in \8216GHC.Base\8217
" + , DisplayData MimeHtml "
type String :: *
\ntype String = [Char]
\t
-- Defined in \8216GHC.Base\8217
" ]]] #else diff --git a/test/acceptance.nbconvert.in.ipynb b/test/acceptance.nbconvert.in.ipynb index 98292de1..590980f8 100644 --- a/test/acceptance.nbconvert.in.ipynb +++ b/test/acceptance.nbconvert.in.ipynb @@ -284,6 +284,7 @@ ".hoogle-class {\n", "font-weight: bold;\n", "}\n", + "\n", ".get-type {\n", "color: green;\n", "font-weight: bold;\n", @@ -315,10 +316,12 @@ ".err-msg.in.collapse {\n", "padding-top: 0.7em;\n", "}\n", + "\n", ".highlight-code {\n", "white-space: pre;\n", "font-family: monospace;\n", "}\n", + "\n", ".suggestion-warning { \n", "font-weight: bold;\n", "color: rgb(200, 130, 0);\n", @@ -330,10 +333,11 @@ ".suggestion-name {\n", "font-weight: bold;\n", "}\n", - "3 + 3 :: forall a. Num a => a" + "\n", + "3 + 3 :: forall {a}. Num a => a" ], "text/plain": [ - "3 + 3 :: forall a. Num a => a" + "3 + 3 :: forall {a}. Num a => a" ] }, "metadata": {}, @@ -355,15 +359,6 @@ { "cell_type": "code", "execution_count": 10, - "metadata": {}, - "outputs": [], - "source": [ - ":opt no-pager" - ] - }, - { - "cell_type": "code", - "execution_count": 11, "metadata": { "tags": [] }, @@ -371,92 +366,11 @@ { "data": { "text/html": [ - "
type Integral :: * -> Constraint
\n", + "
type Integral :: * -> Constraint
\n", "class (Real a, Enum a) => Integral a where
quot :: a -> a -> a
rem :: a -> a -> a
div :: a -> a -> a
mod :: a -> a -> a
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
toInteger :: a -> Integer
{-# MINIMAL quotRem, toInteger #-}
\t
-- Defined in ‘GHC.Real’
\n", - "instance Integral Word -- Defined in ‘GHC.Real’
\n", + "instance Integral Int -- Defined in ‘GHC.Real’
\n", "instance Integral Integer -- Defined in ‘GHC.Real’
\n", - "instance Integral Int -- Defined in ‘GHC.Real’
" + "instance Integral Word -- Defined in ‘GHC.Real’
" ], "text/plain": [ "type Integral :: * -> Constraint\n", @@ -470,9 +384,9 @@ " toInteger :: a -> Integer\n", " {-# MINIMAL quotRem, toInteger #-}\n", " \t-- Defined in ‘GHC.Real’\n", - "instance Integral Word -- Defined in ‘GHC.Real’\n", + "instance Integral Int -- Defined in ‘GHC.Real’\n", "instance Integral Integer -- Defined in ‘GHC.Real’\n", - "instance Integral Int -- Defined in ‘GHC.Real’" + "instance Integral Word -- Defined in ‘GHC.Real’" ] }, "metadata": {}, @@ -491,6 +405,66 @@ "## Test `IHaskellDisplay`" ] }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
Look!
" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
Look!
" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
Look!
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "import IHaskell.Display\n", + "\n", + "data Color = Red | Green | Blue\n", + "\n", + "instance IHaskellDisplay Color where\n", + " display color = return $ Display [html code]\n", + " where\n", + " code = concat [\"
Look!
\"]\n", + " css Red = \"red\"\n", + " css Blue = \"blue\"\n", + " css Green = \"green\"\n", + "\n", + "Red\n", + "Green\n", + "Blue" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Test `hlint` " + ] + }, { "cell_type": "code", "execution_count": 12, @@ -534,6 +508,7 @@ ".hoogle-class {\n", "font-weight: bold;\n", "}\n", + "\n", ".get-type {\n", "color: green;\n", "font-weight: bold;\n", @@ -565,10 +540,12 @@ ".err-msg.in.collapse {\n", "padding-top: 0.7em;\n", "}\n", + "\n", ".highlight-code {\n", "white-space: pre;\n", "font-family: monospace;\n", "}\n", + "\n", ".suggestion-warning { \n", "font-weight: bold;\n", "color: rgb(200, 130, 0);\n", @@ -580,309 +557,7 @@ ".suggestion-name {\n", "font-weight: bold;\n", "}\n", - "
Look!
" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
Look!
" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "
Look!
" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "import IHaskell.Display\n", - "\n", - "data Color = Red | Green | Blue\n", - "\n", - "instance IHaskellDisplay Color where\n", - " display color = return $ Display [html code]\n", - " where\n", - " code = concat [\"
Look!
\"]\n", - " css Red = \"red\"\n", - " css Blue = \"blue\"\n", - " css Green = \"green\"\n", - "\n", - "Red\n", - "Green\n", - "Blue" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Test `hlint` " - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
Redundant $
Found:
f $ 3
Why Not:
f 3
" ], "text/plain": [ @@ -925,7 +600,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 13, "metadata": {}, "outputs": [ { @@ -971,7 +646,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -1021,6 +696,7 @@ ".hoogle-class {\n", "font-weight: bold;\n", "}\n", + "\n", ".get-type {\n", "color: green;\n", "font-weight: bold;\n", @@ -1052,10 +728,12 @@ ".err-msg.in.collapse {\n", "padding-top: 0.7em;\n", "}\n", + "\n", ".highlight-code {\n", "white-space: pre;\n", "font-family: monospace;\n", "}\n", + "\n", ".suggestion-warning { \n", "font-weight: bold;\n", "color: rgb(200, 130, 0);\n", @@ -1067,6 +745,7 @@ ".suggestion-name {\n", "font-weight: bold;\n", "}\n", + "\n", "x = 'a' : 'b' : 'c' : 'd' : _\n", "" ], @@ -1095,7 +774,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ @@ -1118,7 +797,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -1157,7 +836,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -1184,7 +863,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -1227,7 +906,7 @@ "mimetype": "text/x-haskell", "name": "haskell", "pygments_lexer": "Haskell", - "version": "9.2.8" + "version": "9.4.5" }, "latex_envs": { "bibliofile": "biblio.bib",