Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gargantext-ihaskell
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
gargantext-ihaskell
Commits
d6a5af4f
Commit
d6a5af4f
authored
Jul 18, 2018
by
MMesch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new jupyterlab mime types
parent
cb9576c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
0 deletions
+60
-0
Types.hs
ipython-kernel/src/IHaskell/IPython/Types.hs
+21
-0
Display.hs
src/IHaskell/Display.hs
+39
-0
No files found.
ipython-kernel/src/IHaskell/IPython/Types.hs
View file @
d6a5af4f
...
...
@@ -563,11 +563,18 @@ type Height = Int
data
MimeType
=
PlainText
|
MimeHtml
|
MimeBmp
Width
Height
|
MimePng
Width
Height
|
MimeJpg
Width
Height
|
MimeGif
Width
Height
|
MimeSvg
|
MimeLatex
|
MimeMarkdown
|
MimeJavascript
|
MimeJson
|
MimeVega
|
MimeVegalite
|
MimeVdom
deriving
(
Eq
,
Typeable
,
Generic
)
-- Extract the plain text from a list of displays.
...
...
@@ -582,17 +589,31 @@ extractPlain disps =
instance
Show
MimeType
where
show
PlainText
=
"text/plain"
show
MimeHtml
=
"text/html"
show
(
MimeBmp
_
_
)
=
"image/bmp"
show
(
MimePng
_
_
)
=
"image/png"
show
(
MimeJpg
_
_
)
=
"image/jpeg"
show
(
MimeGif
_
_
)
=
"image/gif"
show
MimeSvg
=
"image/svg+xml"
show
MimeLatex
=
"text/latex"
show
MimeMarkdown
=
"text/markdown"
show
MimeJavascript
=
"application/javascript"
show
MimeJson
=
"application/json"
show
MimeVega
=
"application/vnd.vega.v2+json"
show
MimeVegalite
=
"application/vnd.vegalite.v1+json"
show
MimeVdom
=
"application/vdom.v1+json"
instance
Read
MimeType
where
readsPrec
_
"text/plain"
=
[(
PlainText
,
""
)]
readsPrec
_
"text/html"
=
[(
MimeHtml
,
""
)]
readsPrec
_
"image/bmp"
=
[(
MimeBmp
50
50
,
""
)]
readsPrec
_
"image/png"
=
[(
MimePng
50
50
,
""
)]
readsPrec
_
"image/jpg"
=
[(
MimeJpg
50
50
,
""
)]
readsPrec
_
"image/gif"
=
[(
MimeGif
50
50
,
""
)]
readsPrec
_
"image/svg+xml"
=
[(
MimeSvg
,
""
)]
readsPrec
_
"text/latex"
=
[(
MimeLatex
,
""
)]
readsPrec
_
"text/markdown"
=
[(
MimeMarkdown
,
""
)]
readsPrec
_
"application/javascript"
=
[(
MimeJavascript
,
""
)]
readsPrec
_
"application/json"
=
[(
MimeJson
,
""
)]
readsPrec
_
"application/vnd.vega.v2+json"
=
[(
MimeVega
,
""
)]
readsPrec
_
"application/vnd.vegalite.v1+json"
=
[(
MimeVegalite
,
""
)]
readsPrec
_
"application/vdom.v1+json"
=
[(
MimeVdom
,
""
)]
src/IHaskell/Display.hs
View file @
d6a5af4f
...
...
@@ -25,11 +25,18 @@ module IHaskell.Display (
-- * Constructors for displays
plain
,
html
,
bmp
,
png
,
jpg
,
gif
,
svg
,
latex
,
markdown
,
javascript
,
json
,
vega
,
vegalite
,
vdom
,
many
,
-- ** Image and data encoding functions
...
...
@@ -119,6 +126,38 @@ latex = DisplayData MimeLatex . T.pack
javascript
::
String
->
DisplayData
javascript
=
DisplayData
MimeJavascript
.
T
.
pack
-- | Generate a Json display.
json
::
String
->
DisplayData
json
=
DisplayData
MimeJson
.
T
.
pack
-- | Generate a Vega display.
vega
::
String
->
DisplayData
vega
=
DisplayData
MimeVega
.
T
.
pack
-- | Generate a Vegalite display.
vegalite
::
String
->
DisplayData
vegalite
=
DisplayData
MimeVegalite
.
T
.
pack
-- | Generate a Vdom display.
vdom
::
String
->
DisplayData
vdom
=
DisplayData
MimeVdom
.
T
.
pack
-- | Generate a Markdown display.
markdown
::
String
->
DisplayData
markdown
=
DisplayData
MimeMarkdown
.
T
.
pack
-- | Generate a GIF display of the given width and height. Data must be provided in a Base64 encoded
-- manner, suitable for embedding into HTML. The @base64@ function may be used to encode data into
-- this format.
gif
::
Width
->
Height
->
Base64
->
DisplayData
gif
width
height
=
DisplayData
(
MimeGif
width
height
)
-- | Generate a BMP display of the given width and height. Data must be provided in a Base64 encoded
-- manner, suitable for embedding into HTML. The @base64@ function may be used to encode data into
-- this format.
bmp
::
Width
->
Height
->
Base64
->
DisplayData
bmp
width
height
=
DisplayData
(
MimeBmp
width
height
)
-- | Generate a PNG display of the given width and height. Data must be provided in a Base64 encoded
-- manner, suitable for embedding into HTML. The @base64@ function may be used to encode data into
-- this format.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment