Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
decker
decker
Commits
b5716c65
Commit
b5716c65
authored
Apr 25, 2021
by
Henrik Tramberend
Browse files
Add embedded PlantUML rendering
parent
dc340f96
Changes
6
Hide whitespace changes
Inline
Side-by-side
app/Decker.hs
View file @
b5716c65
...
...
@@ -258,14 +258,23 @@ run = do
need
[
src
]
command
[]
"sass"
[
src
,
out
]
--
"**/*.plantuml.svg"
%>
\
out
->
do
let
src
=
dropExtension
out
need
[
src
]
putNormal
$
"# plantuml (for "
<>
out
<>
")"
plantuml
[
src
]
liftIO
$
Dir
.
renameFile
(
src
-<.>
"svg"
)
out
--
"**/*.dot.svg"
%>
\
out
->
do
let
src
=
dropExtension
out
need
[
src
]
putNormal
$
"# dot (for "
<>
out
<>
")"
dot
[
"-o"
++
out
,
src
]
--
"**/*.gnuplot.svg"
%>
\
out
->
do
let
src
=
dropExtension
out
need
[
src
]
putNormal
$
"# gnuplot (for "
<>
out
<>
")"
gnuplot
[
"-e"
,
"
\"
set output '"
++
out
++
"'
\"
"
,
src
]
--
"**/*-recording.mp4"
%>
\
out
->
do
...
...
src/Text/Decker/Filter/Image.hs
View file @
b5716c65
...
...
@@ -98,7 +98,7 @@ transformImages images caption = do
H
.
div
!
A
.
class_
"decker image-row"
$
toHtml
$
map
toHtml
imageRow
H
.
figcaption
captionHtml
language
cls
=
find
(`
elem
`
[
"dot"
,
"gnuplot"
,
"tex"
])
cls
language
cls
=
find
(`
elem
`
[
"plantuml"
,
"dot"
,
"gnuplot"
,
"tex"
])
cls
-- TODO this is incomplete
-- - captions are just swallowed but never rendered.
...
...
@@ -107,6 +107,8 @@ transformCodeBlock :: Block -> [Inline] -> Filter Block
transformCodeBlock
code
@
(
CodeBlock
attr
@
(
_
,
classes
,
_
)
text
)
caption
=
handle
(
blockError
code
)
$
if
|
all
(`
elem
`
classes
)
[
"plantuml"
,
"render"
]
->
runAttr
attr
(
transform
"plantuml"
)
>>=
renderHtml
|
all
(`
elem
`
classes
)
[
"dot"
,
"render"
]
->
runAttr
attr
(
transform
"dot"
)
>>=
renderHtml
|
all
(`
elem
`
classes
)
[
"gnuplot"
,
"render"
]
->
...
...
src/Text/Decker/Filter/Local.hs
View file @
b5716c65
...
...
@@ -61,7 +61,7 @@ svgExt = ["svg"]
yamlExt
=
[
"yaml"
,
"yml"
]
renderExt
=
[
"dot"
,
"gnuplot"
,
"tex"
]
renderExt
=
[
"dot"
,
"gnuplot"
,
"tex"
,
"plantuml"
]
javascriptExt
=
[
"js"
]
...
...
src/Text/Decker/Internal/External.hs
View file @
b5716c65
...
...
@@ -5,6 +5,7 @@ module Text.Decker.Internal.External
(
ssh
,
rsync
,
dot
,
plantuml
,
gnuplot
,
pdflatex
,
pdf2svg
,
...
...
@@ -63,6 +64,14 @@ programs =
[
"-V"
]
(
helpText
"Graphviz (http://www.graphviz.org)"
)
),
(
"plantuml"
,
ExternalProgram
-- []
"plantuml"
[
"-tsvg"
]
[
"--version"
]
(
helpText
"Plantuml (https://plantuml.com)"
)
),
(
"gnuplot"
,
ExternalProgram
-- []
...
...
@@ -100,6 +109,9 @@ rsync = makeProgram "rsync"
dot
::
Program
dot
=
makeProgram
"dot"
plantuml
::
Program
plantuml
=
makeProgram
"plantuml"
gnuplot
::
Program
gnuplot
=
makeProgram
"gnuplot"
...
...
test/decks/alice-bob.plantuml
0 → 100644
View file @
b5716c65
@startuml
skinparam shadowing false
skinparam monochrome true
Alice -> Bob: test
@enduml
\ No newline at end of file
test/decks/rendered-code-deck.md
View file @
b5716c65
...
...
@@ -12,13 +12,39 @@ Code blocks can be rendered as SVG images
-
Gnuplot
-
Tikz
------
------------------------------------------------------------------------
# Embedded PlantUML Code (SVG) {.columns}
## PlantUML {.left}
````
{.markdown}
``` {.plantuml .render}
@startuml
skinparam shadowing false
skinparam monochrome true
Alice -> Bob: test
@enduml
```
````
## SVG {.right}
```
{.plantuml .render width="100%"}
@startuml
skinparam shadowing false
skinparam monochrome true
Alice -> Bob: test
@enduml
```
------------------------------------------------------------------------
# Embedded Graphviz Code (SVG) {layout="columns"}
## Highlighted {.left}
````
{.
dot
}
````
{.
markdown
}
``` {.dot .render width="80%"}
digraph {
node [style = filled]
...
...
@@ -48,7 +74,7 @@ digraph {
}
```
------
------
------------------------------------------------------------------
# Embedded Gnuplot (SVG) {layout="columns"}
...
...
@@ -82,7 +108,21 @@ DEBUG_TERM_VTIC = 118
splot 1 / (x*x + y*y + 0.5)
```
------
------------------------------------------------------------------------
# PlantUML Files as Images {layout="columns"}
## Image Tag {.left}
```
{.markdown}
{.render}
```
## Rendered and included {.right}

{.plantuml .render}
------------------------------------------------------------------------
# Dot Files as Images {layout="columns"}
...
...
@@ -96,7 +136,7 @@ splot 1 / (x*x + y*y + 0.5)

{.dot .render}
------
------
------------------------------------------------------------------
# Tikz Files as Images {layout="columns"}
...
...
@@ -110,7 +150,7 @@ splot 1 / (x*x + y*y + 0.5)

{.tex .render}
------
------
------------------------------------------------------------------
# Tikz Embedded
...
...
@@ -173,4 +213,3 @@ splot 1 / (x*x + y*y + 0.5)
\end{tikzpicture}
\end{document}
```
Write
Preview
Supports
Markdown
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