packages feed

pandoc-plot 0.8.0.0 → 0.8.1.0

raw patch · 19 files changed

+430/−244 lines, 19 filesdep +data-defaultdep +tagsoupdep ~pandoc-typesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: data-default, tagsoup

Dependency ranges changed: pandoc-types

API changes (from Hackage documentation)

- Text.Pandoc.Filter.Plot.Internal: Bokeh :: Toolkit
- Text.Pandoc.Filter.Plot.Internal: CaptionFormatK :: InclusionKey
- Text.Pandoc.Filter.Plot.Internal: CaptionK :: InclusionKey
- Text.Pandoc.Filter.Plot.Internal: CheckFailed :: Text -> CheckResult
- Text.Pandoc.Filter.Plot.Internal: CheckPassed :: CheckResult
- Text.Pandoc.Filter.Plot.Internal: Configuration :: !FilePath -> !Bool -> !Int -> !SaveFormat -> !Format -> !Verbosity -> !LogSink -> !Script -> !Script -> !Script -> !Script -> !Script -> !Script -> !Script -> !Script -> !Script -> !Script -> !Script -> !FilePath -> !FilePath -> !FilePath -> !FilePath -> !FilePath -> !FilePath -> !FilePath -> !FilePath -> !FilePath -> !FilePath -> !FilePath -> !Bool -> !Bool -> Configuration
- Text.Pandoc.Filter.Plot.Internal: Debug :: Verbosity
- Text.Pandoc.Filter.Plot.Internal: DirectoryK :: InclusionKey
- Text.Pandoc.Filter.Plot.Internal: DpiK :: InclusionKey
- Text.Pandoc.Filter.Plot.Internal: EPS :: SaveFormat
- Text.Pandoc.Filter.Plot.Internal: Error :: Verbosity
- Text.Pandoc.Filter.Plot.Internal: ExecutableK :: InclusionKey
- Text.Pandoc.Filter.Plot.Internal: FigureSpec :: !Toolkit -> !Text -> !Bool -> !Script -> !SaveFormat -> !FilePath -> !Int -> ![(Text, Text)] -> !Attr -> FigureSpec
- Text.Pandoc.Filter.Plot.Internal: GGPlot2 :: Toolkit
- Text.Pandoc.Filter.Plot.Internal: GIF :: SaveFormat
- Text.Pandoc.Filter.Plot.Internal: GNUPlot :: Toolkit
- Text.Pandoc.Filter.Plot.Internal: Graphviz :: Toolkit
- Text.Pandoc.Filter.Plot.Internal: HTML :: SaveFormat
- Text.Pandoc.Filter.Plot.Internal: Info :: Verbosity
- Text.Pandoc.Filter.Plot.Internal: JPG :: SaveFormat
- Text.Pandoc.Filter.Plot.Internal: LogFile :: FilePath -> LogSink
- Text.Pandoc.Filter.Plot.Internal: Mathematica :: Toolkit
- Text.Pandoc.Filter.Plot.Internal: Matlab :: Toolkit
- Text.Pandoc.Filter.Plot.Internal: Matplotlib :: Toolkit
- Text.Pandoc.Filter.Plot.Internal: MatplotlibTightBBoxK :: InclusionKey
- Text.Pandoc.Filter.Plot.Internal: MatplotlibTransparentK :: InclusionKey
- Text.Pandoc.Filter.Plot.Internal: Octave :: Toolkit
- Text.Pandoc.Filter.Plot.Internal: OutputSpec :: FigureSpec -> FilePath -> FilePath -> OutputSpec
- Text.Pandoc.Filter.Plot.Internal: PDF :: SaveFormat
- Text.Pandoc.Filter.Plot.Internal: PNG :: SaveFormat
- Text.Pandoc.Filter.Plot.Internal: PlotlyPython :: Toolkit
- Text.Pandoc.Filter.Plot.Internal: PlotlyR :: Toolkit
- Text.Pandoc.Filter.Plot.Internal: Plotsjl :: Toolkit
- Text.Pandoc.Filter.Plot.Internal: PreambleK :: InclusionKey
- Text.Pandoc.Filter.Plot.Internal: RuntimeEnv :: Configuration -> Logger -> RuntimeEnv
- Text.Pandoc.Filter.Plot.Internal: SVG :: SaveFormat
- Text.Pandoc.Filter.Plot.Internal: SaveFormatK :: InclusionKey
- Text.Pandoc.Filter.Plot.Internal: ScriptChecksFailed :: Text -> ScriptResult
- Text.Pandoc.Filter.Plot.Internal: ScriptFailure :: Text -> Int -> ScriptResult
- Text.Pandoc.Filter.Plot.Internal: ScriptSuccess :: ScriptResult
- Text.Pandoc.Filter.Plot.Internal: Silent :: Verbosity
- Text.Pandoc.Filter.Plot.Internal: StdErr :: LogSink
- Text.Pandoc.Filter.Plot.Internal: TIF :: SaveFormat
- Text.Pandoc.Filter.Plot.Internal: ToolkitNotInstalled :: Toolkit -> ScriptResult
- Text.Pandoc.Filter.Plot.Internal: WEBP :: SaveFormat
- Text.Pandoc.Filter.Plot.Internal: Warning :: Verbosity
- Text.Pandoc.Filter.Plot.Internal: WithSourceK :: InclusionKey
- Text.Pandoc.Filter.Plot.Internal: [blockAttrs] :: FigureSpec -> !Attr
- Text.Pandoc.Filter.Plot.Internal: [bokehExe] :: Configuration -> !FilePath
- Text.Pandoc.Filter.Plot.Internal: [bokehPreamble] :: Configuration -> !Script
- Text.Pandoc.Filter.Plot.Internal: [captionFormat] :: Configuration -> !Format
- Text.Pandoc.Filter.Plot.Internal: [caption] :: FigureSpec -> !Text
- Text.Pandoc.Filter.Plot.Internal: [defaultDPI] :: Configuration -> !Int
- Text.Pandoc.Filter.Plot.Internal: [defaultDirectory] :: Configuration -> !FilePath
- Text.Pandoc.Filter.Plot.Internal: [defaultSaveFormat] :: Configuration -> !SaveFormat
- Text.Pandoc.Filter.Plot.Internal: [defaultWithSource] :: Configuration -> !Bool
- Text.Pandoc.Filter.Plot.Internal: [directory] :: FigureSpec -> !FilePath
- Text.Pandoc.Filter.Plot.Internal: [dpi] :: FigureSpec -> !Int
- Text.Pandoc.Filter.Plot.Internal: [envConfig] :: RuntimeEnv -> Configuration
- Text.Pandoc.Filter.Plot.Internal: [envLogger] :: RuntimeEnv -> Logger
- Text.Pandoc.Filter.Plot.Internal: [extraAttrs] :: FigureSpec -> ![(Text, Text)]
- Text.Pandoc.Filter.Plot.Internal: [ggplot2Exe] :: Configuration -> !FilePath
- Text.Pandoc.Filter.Plot.Internal: [ggplot2Preamble] :: Configuration -> !Script
- Text.Pandoc.Filter.Plot.Internal: [gnuplotExe] :: Configuration -> !FilePath
- Text.Pandoc.Filter.Plot.Internal: [gnuplotPreamble] :: Configuration -> !Script
- Text.Pandoc.Filter.Plot.Internal: [graphvizExe] :: Configuration -> !FilePath
- Text.Pandoc.Filter.Plot.Internal: [graphvizPreamble] :: Configuration -> !Script
- Text.Pandoc.Filter.Plot.Internal: [logSink] :: Configuration -> !LogSink
- Text.Pandoc.Filter.Plot.Internal: [logVerbosity] :: Configuration -> !Verbosity
- Text.Pandoc.Filter.Plot.Internal: [mathematicaExe] :: Configuration -> !FilePath
- Text.Pandoc.Filter.Plot.Internal: [mathematicaPreamble] :: Configuration -> !Script
- Text.Pandoc.Filter.Plot.Internal: [matlabExe] :: Configuration -> !FilePath
- Text.Pandoc.Filter.Plot.Internal: [matlabPreamble] :: Configuration -> !Script
- Text.Pandoc.Filter.Plot.Internal: [matplotlibExe] :: Configuration -> !FilePath
- Text.Pandoc.Filter.Plot.Internal: [matplotlibPreamble] :: Configuration -> !Script
- Text.Pandoc.Filter.Plot.Internal: [matplotlibTightBBox] :: Configuration -> !Bool
- Text.Pandoc.Filter.Plot.Internal: [matplotlibTransparent] :: Configuration -> !Bool
- Text.Pandoc.Filter.Plot.Internal: [oFigurePath] :: OutputSpec -> FilePath
- Text.Pandoc.Filter.Plot.Internal: [oFigureSpec] :: OutputSpec -> FigureSpec
- Text.Pandoc.Filter.Plot.Internal: [oScriptPath] :: OutputSpec -> FilePath
- Text.Pandoc.Filter.Plot.Internal: [octaveExe] :: Configuration -> !FilePath
- Text.Pandoc.Filter.Plot.Internal: [octavePreamble] :: Configuration -> !Script
- Text.Pandoc.Filter.Plot.Internal: [plotlyPythonExe] :: Configuration -> !FilePath
- Text.Pandoc.Filter.Plot.Internal: [plotlyPythonPreamble] :: Configuration -> !Script
- Text.Pandoc.Filter.Plot.Internal: [plotlyRExe] :: Configuration -> !FilePath
- Text.Pandoc.Filter.Plot.Internal: [plotlyRPreamble] :: Configuration -> !Script
- Text.Pandoc.Filter.Plot.Internal: [plotsjlExe] :: Configuration -> !FilePath
- Text.Pandoc.Filter.Plot.Internal: [plotsjlPreamble] :: Configuration -> !Script
- Text.Pandoc.Filter.Plot.Internal: [saveFormat] :: FigureSpec -> !SaveFormat
- Text.Pandoc.Filter.Plot.Internal: [script] :: FigureSpec -> !Script
- Text.Pandoc.Filter.Plot.Internal: [toolkit] :: FigureSpec -> !Toolkit
- Text.Pandoc.Filter.Plot.Internal: [withSource] :: FigureSpec -> !Bool
- Text.Pandoc.Filter.Plot.Internal: ask :: MonadReader r m => m r
- Text.Pandoc.Filter.Plot.Internal: asks :: MonadReader r m => (r -> a) -> m a
- Text.Pandoc.Filter.Plot.Internal: asksConfig :: (Configuration -> a) -> PlotM a
- Text.Pandoc.Filter.Plot.Internal: availableToolkits :: Configuration -> IO [Toolkit]
- Text.Pandoc.Filter.Plot.Internal: availableToolkitsM :: PlotM [Toolkit]
- Text.Pandoc.Filter.Plot.Internal: captionReader :: Format -> Text -> Maybe [Inline]
- Text.Pandoc.Filter.Plot.Internal: capture :: Toolkit -> FigureSpec -> FilePath -> Script
- Text.Pandoc.Filter.Plot.Internal: cleanOutputDirs :: Walkable Block b => Configuration -> b -> IO [FilePath]
- Text.Pandoc.Filter.Plot.Internal: cls :: Toolkit -> Text
- Text.Pandoc.Filter.Plot.Internal: command :: Toolkit -> OutputSpec -> PlotM Text
- Text.Pandoc.Filter.Plot.Internal: comment :: Toolkit -> Text -> Text
- Text.Pandoc.Filter.Plot.Internal: configuration :: FilePath -> IO Configuration
- Text.Pandoc.Filter.Plot.Internal: configurationPathMeta :: Pandoc -> Maybe FilePath
- Text.Pandoc.Filter.Plot.Internal: data CheckResult
- Text.Pandoc.Filter.Plot.Internal: data Configuration
- Text.Pandoc.Filter.Plot.Internal: data FigureSpec
- Text.Pandoc.Filter.Plot.Internal: data InclusionKey
- Text.Pandoc.Filter.Plot.Internal: data LogSink
- Text.Pandoc.Filter.Plot.Internal: data OutputSpec
- Text.Pandoc.Filter.Plot.Internal: data RuntimeEnv
- Text.Pandoc.Filter.Plot.Internal: data SaveFormat
- Text.Pandoc.Filter.Plot.Internal: data ScriptResult
- Text.Pandoc.Filter.Plot.Internal: data Toolkit
- Text.Pandoc.Filter.Plot.Internal: data Verbosity
- Text.Pandoc.Filter.Plot.Internal: debug :: Text -> PlotM ()
- Text.Pandoc.Filter.Plot.Internal: defaultConfiguration :: Configuration
- Text.Pandoc.Filter.Plot.Internal: defaultReaderOptions :: ReaderOptions
- Text.Pandoc.Filter.Plot.Internal: err :: Text -> PlotM ()
- Text.Pandoc.Filter.Plot.Internal: executable :: Toolkit -> PlotM FilePath
- Text.Pandoc.Filter.Plot.Internal: extension :: SaveFormat -> String
- Text.Pandoc.Filter.Plot.Internal: figureContentHash :: FigureSpec -> Int
- Text.Pandoc.Filter.Plot.Internal: inclusionKeys :: [InclusionKey]
- Text.Pandoc.Filter.Plot.Internal: info :: Text -> PlotM ()
- Text.Pandoc.Filter.Plot.Internal: isWindows :: Bool
- Text.Pandoc.Filter.Plot.Internal: liftIO :: MonadIO m => IO a -> m a
- Text.Pandoc.Filter.Plot.Internal: parseExtraAttrs :: Toolkit -> Map Text Text -> Map Text Text
- Text.Pandoc.Filter.Plot.Internal: parseFigureSpec :: Block -> PlotM (Maybe FigureSpec)
- Text.Pandoc.Filter.Plot.Internal: plotToolkit :: Block -> Maybe Toolkit
- Text.Pandoc.Filter.Plot.Internal: preambleSelector :: Toolkit -> Configuration -> Script
- Text.Pandoc.Filter.Plot.Internal: readDoc :: FilePath -> IO Pandoc
- Text.Pandoc.Filter.Plot.Internal: runCommand :: Text -> PlotM (ExitCode, Text)
- Text.Pandoc.Filter.Plot.Internal: runPlotM :: Configuration -> PlotM a -> IO a
- Text.Pandoc.Filter.Plot.Internal: runScriptIfNecessary :: FigureSpec -> PlotM ScriptResult
- Text.Pandoc.Filter.Plot.Internal: runTempScript :: FigureSpec -> PlotM ScriptResult
- Text.Pandoc.Filter.Plot.Internal: scriptChecks :: Toolkit -> [Script -> CheckResult]
- Text.Pandoc.Filter.Plot.Internal: scriptExtension :: Toolkit -> String
- Text.Pandoc.Filter.Plot.Internal: supportedSaveFormats :: Toolkit -> [SaveFormat]
- Text.Pandoc.Filter.Plot.Internal: toImage :: Format -> FigureSpec -> Block
- Text.Pandoc.Filter.Plot.Internal: toolkitAvailable :: Toolkit -> PlotM Bool
- Text.Pandoc.Filter.Plot.Internal: toolkits :: [Toolkit]
- Text.Pandoc.Filter.Plot.Internal: type PlotM a = ReaderT RuntimeEnv IO a
- Text.Pandoc.Filter.Plot.Internal: type Script = Text
- Text.Pandoc.Filter.Plot.Internal: unavailableToolkits :: Configuration -> IO [Toolkit]
- Text.Pandoc.Filter.Plot.Internal: unavailableToolkitsM :: PlotM [Toolkit]
- Text.Pandoc.Filter.Plot.Internal: warning :: Text -> PlotM ()
+ Text.Pandoc.Filter.Plot: Bokeh :: Toolkit
+ Text.Pandoc.Filter.Plot: CaptionFormatK :: InclusionKey
+ Text.Pandoc.Filter.Plot: CaptionK :: InclusionKey
+ Text.Pandoc.Filter.Plot: DirectoryK :: InclusionKey
+ Text.Pandoc.Filter.Plot: DpiK :: InclusionKey
+ Text.Pandoc.Filter.Plot: ExecutableK :: InclusionKey
+ Text.Pandoc.Filter.Plot: GGPlot2 :: Toolkit
+ Text.Pandoc.Filter.Plot: GNUPlot :: Toolkit
+ Text.Pandoc.Filter.Plot: Graphviz :: Toolkit
+ Text.Pandoc.Filter.Plot: Mathematica :: Toolkit
+ Text.Pandoc.Filter.Plot: Matlab :: Toolkit
+ Text.Pandoc.Filter.Plot: Matplotlib :: Toolkit
+ Text.Pandoc.Filter.Plot: MatplotlibTightBBoxK :: InclusionKey
+ Text.Pandoc.Filter.Plot: MatplotlibTransparentK :: InclusionKey
+ Text.Pandoc.Filter.Plot: Octave :: Toolkit
+ Text.Pandoc.Filter.Plot: PlotlyPython :: Toolkit
+ Text.Pandoc.Filter.Plot: PlotlyR :: Toolkit
+ Text.Pandoc.Filter.Plot: Plotsjl :: Toolkit
+ Text.Pandoc.Filter.Plot: PreambleK :: InclusionKey
+ Text.Pandoc.Filter.Plot: SaveFormatK :: InclusionKey
+ Text.Pandoc.Filter.Plot: WithSourceK :: InclusionKey
+ Text.Pandoc.Filter.Plot: captionReader :: Format -> Text -> Maybe [Inline]
+ Text.Pandoc.Filter.Plot: cls :: Toolkit -> Text
+ Text.Pandoc.Filter.Plot: configurationPathMeta :: Pandoc -> Maybe FilePath
+ Text.Pandoc.Filter.Plot: data InclusionKey
+ Text.Pandoc.Filter.Plot: data Toolkit
+ Text.Pandoc.Filter.Plot: executable :: Toolkit -> PlotM FilePath
+ Text.Pandoc.Filter.Plot: extension :: SaveFormat -> String
+ Text.Pandoc.Filter.Plot: extractPlot :: Text -> Text
+ Text.Pandoc.Filter.Plot: inclusionKeys :: [InclusionKey]
+ Text.Pandoc.Filter.Plot: runPlotM :: Configuration -> PlotM a -> IO a
+ Text.Pandoc.Filter.Plot: supportedSaveFormats :: Toolkit -> [SaveFormat]
+ Text.Pandoc.Filter.Plot: toolkits :: [Toolkit]
+ Text.Pandoc.Filter.Plot: type PlotM a = ReaderT RuntimeEnv IO a

Files

CHANGELOG.md view
@@ -2,6 +2,13 @@ 
 pandoc-plot uses [Semantic Versioning](http://semver.org/spec/v2.0.0.html)
 
+Release 0.8.1.0
+---------------
+
+* The module `Text.Pandoc.Filter.Plot.Internal` is no longer exposed; instead, everything relevant is exposed by the `Text.Pandoc.Filter.Plot` module.
+* Fixed an issue where script errors would be logged as debug messages.
+* Interactive plots are now embedded directly in output (#7).
+
 Release 0.8.0.0
 ---------------
 
MANUAL.md view
@@ -1,9 +1,8 @@ <!--
-The file MANUAL.md is automatically generated by the mkmanual.ps1 script 
-Do not edit manually
+The file MANUAL.md is automatically generated by the tools/mkmanual.ps1 script. Do not edit manually.
 -->
 
-# pandoc-plot 0.8.0.0
+# pandoc-plot 0.8.1.0
 
 ## A Pandoc filter to generate figures from code blocks in documents
 
@@ -13,13 +12,14 @@       - [Captions](#captions)
       - [Link to source code](#link-to-source-code)
       - [Preamble scripts](#preamble-scripts)
-      - [Support for interative plots](#support-for-interative-plots)
+      - [Support for interactive plots](#support-for-interactive-plots)
       - [Performance](#performance)
       - [Compatibility with pandoc-crossref](#compatibility-with-pandoc-crossref)
   - [Detailed usage](#detailed-usage)
       - [As a filter](#as-a-filter)
       - [Syntax](#syntax)
       - [Parameters and options](#parameters-and-options)
+      - [Interactive HTML figures](#interactive-html-figures)
       - [Configuration](#configuration)
       - [Other commands](#other-commands)
   - [Warning](#warning)
@@ -124,7 +124,7 @@ 
 This `preamble` parameter is perfect for longer documents with many plots. Simply define the style you want in a separate script\! You can also import packages this way, or define functions you often use.
 
-### Support for interative plots
+### Support for interactive plots
 
 Starting with version 0.8.0.0, `pandoc-plot` supports the creation of interactive plots (if a toolkit supports it). All you need to do is set the save format to `html`. The resulting plot is fully self-contained, so it can be displayed offline.
 
@@ -161,7 +161,7 @@ `pandoc-plot` is a command line executable with a few functions. You can take a look at the help using the `-h`/`--help` flag:
 
 ``` bash
-pandoc-plot 0.8.0.0 - generate figures directly in documents
+pandoc-plot 0.8.1.0 - generate figures directly in documents
 
 Usage: pandoc-plot.EXE [(-v|--version) | --full-version | (-m|--manual)] 
                        [COMMAND] [AST]
@@ -296,6 +296,20 @@ ```
 
 This way, you benefit from code highlighting *and* `pandoc-plot`.
+
+### Interactive HTML figures
+
+Interactive HTML figures are available for a few toolkits, e.g. `bokeh`. To make a figure interactive, use the output format `format=html`. This only makes sense if your output file is also HTML.
+
+You can take a look at the [demonstration page](https://laurentrdc.github.io/pandoc-plot/) for an example result.
+
+Many interactive plots rely on javascript scripts stored on the internet. If you want to have a self-contained document that can be viewed offline – or you want your document to work for the next 10 years –, you can use pandoc’s `--self-contained` flag:
+
+``` bash
+pandoc --self-contained --filter pandoc-plot -i mydoc.md -o webpage.html 
+```
+
+The resulting output `webpage.html` will contain everything, at the cost of size.
 
 ### Configuration
 
docs/MANUAL.html view
@@ -83,10 +83,9 @@ </head>
 <body>
 <!--
-The file MANUAL.md is automatically generated by the mkmanual.ps1 script 
-Do not edit manually
+The file MANUAL.md is automatically generated by the tools/mkmanual.ps1 script. Do not edit manually.
 -->
-<h1 id="pandoc-plot-0.8.0.0">pandoc-plot 0.8.0.0</h1>
+<h1 id="pandoc-plot-0.8.1.0">pandoc-plot 0.8.1.0</h1>
 <h2 id="a-pandoc-filter-to-generate-figures-from-code-blocks-in-documents">A Pandoc filter to generate figures from code blocks in documents</h2>
 <p><code>pandoc-plot</code> turns code blocks present in your documents (Markdown, LaTeX, etc.) into embedded figures, using your plotting toolkit of choice, including Matplotlib, ggplot2, MATLAB, Mathematica, and more.</p>
 <ul>
@@ -95,7 +94,7 @@ <li><a href="#captions">Captions</a></li>
 <li><a href="#link-to-source-code">Link to source code</a></li>
 <li><a href="#preamble-scripts">Preamble scripts</a></li>
-<li><a href="#support-for-interative-plots">Support for interative plots</a></li>
+<li><a href="#support-for-interactive-plots">Support for interactive plots</a></li>
 <li><a href="#performance">Performance</a></li>
 <li><a href="#compatibility-with-pandoc-crossref">Compatibility with pandoc-crossref</a></li>
 </ul></li>
@@ -104,6 +103,7 @@ <li><a href="#as-a-filter">As a filter</a></li>
 <li><a href="#syntax">Syntax</a></li>
 <li><a href="#parameters-and-options">Parameters and options</a></li>
+<li><a href="#interactive-html-figures">Interactive HTML figures</a></li>
 <li><a href="#configuration">Configuration</a></li>
 <li><a href="#other-commands">Other commands</a></li>
 </ul></li>
@@ -167,7 +167,7 @@ <span id="cb8-2"><a href="#cb8-2" aria-hidden="true"></a></span>
 <span id="cb8-3"><a href="#cb8-3" aria-hidden="true"></a><span class="kw">\end</span>{<span class="ex">minted</span>}</span></code></pre></div>
 <p>This <code>preamble</code> parameter is perfect for longer documents with many plots. Simply define the style you want in a separate script! You can also import packages this way, or define functions you often use.</p>
-<h3 id="support-for-interative-plots">Support for interative plots</h3>
+<h3 id="support-for-interactive-plots">Support for interactive plots</h3>
 <p>Starting with version 0.8.0.0, <code>pandoc-plot</code> supports the creation of interactive plots (if a toolkit supports it). All you need to do is set the save format to <code>html</code>. The resulting plot is fully self-contained, so it can be displayed offline.</p>
 <h3 id="performance">Performance</h3>
 <p><code>pandoc-plot</code> minimizes work, only generating figures if it absolutely must, i.e. if the content has changed. <code>pandoc-plot</code> will save the hash of the source code used to generate a figure in its filename. Before generating a figure, <code>pandoc-plot</code> will check it this figure already exists based on the hash of its source! This also means that there is no way to directly name figures.</p>
@@ -185,7 +185,7 @@ <div class="sourceCode" id="cb10"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true"></a><span class="ex">pandoc</span> --filter pandoc-plot --filter pandoc-crossref -i myfile.md -o myfile.html</span></code></pre></div>
 <h2 id="detailed-usage">Detailed usage</h2>
 <p><code>pandoc-plot</code> is a command line executable with a few functions. You can take a look at the help using the <code>-h</code>/<code>--help</code> flag:</p>
-<div class="sourceCode" id="cb11"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true"></a><span class="ex">pandoc-plot</span> 0.8.0.0 - generate figures directly in documents</span>
+<div class="sourceCode" id="cb11"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true"></a><span class="ex">pandoc-plot</span> 0.8.1.0 - generate figures directly in documents</span>
 <span id="cb11-2"><a href="#cb11-2" aria-hidden="true"></a></span>
 <span id="cb11-3"><a href="#cb11-3" aria-hidden="true"></a><span class="ex">Usage</span>: pandoc-plot.EXE [(-v<span class="kw">|</span><span class="ex">--version</span>) <span class="kw">|</span> <span class="ex">--full-version</span> <span class="kw">|</span> <span class="kw">(</span><span class="ex">-m</span><span class="kw">|</span><span class="ex">--manual</span><span class="kw">)</span>] </span>
 <span id="cb11-4"><a href="#cb11-4" aria-hidden="true"></a>                       [<span class="ex">COMMAND</span>] [AST]</span>
@@ -275,115 +275,121 @@ <span id="cb20-2"><a href="#cb20-2" aria-hidden="true"></a><span class="vs">  # script content</span></span>
 <span id="cb20-3"><a href="#cb20-3" aria-hidden="true"></a><span class="vs">  </span><span class="kw">\end</span>{<span class="ex">minted</span>}</span></code></pre></div>
 <p>This way, you benefit from code highlighting <em>and</em> <code>pandoc-plot</code>.</p>
+<h3 id="interactive-html-figures">Interactive HTML figures</h3>
+<p>Interactive HTML figures are available for a few toolkits, e.g. <code>bokeh</code>. To make a figure interactive, use the output format <code>format=html</code>. This only makes sense if your output file is also HTML.</p>
+<p>You can take a look at the <a href="https://laurentrdc.github.io/pandoc-plot/">demonstration page</a> for an example result.</p>
+<p>Many interactive plots rely on javascript scripts stored on the internet. If you want to have a self-contained document that can be viewed offline – or you want your document to work for the next 10 years –, you can use pandoc’s <code>--self-contained</code> flag:</p>
+<div class="sourceCode" id="cb21"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true"></a><span class="ex">pandoc</span> --self-contained --filter pandoc-plot -i mydoc.md -o webpage.html </span></code></pre></div>
+<p>The resulting output <code>webpage.html</code> will contain everything, at the cost of size.</p>
 <h3 id="configuration">Configuration</h3>
 <p>To avoid repetition, <code>pandoc-plot</code> can be configured using simple YAML
 files. Here are <strong>all</strong> the possible parameters:</p>
-<div class="sourceCode" id="cb21"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true"></a></span>
-<span id="cb21-2"><a href="#cb21-2" aria-hidden="true"></a><span class="co"># This is an example configuration. Everything in this file is optional.</span></span>
-<span id="cb21-3"><a href="#cb21-3" aria-hidden="true"></a><span class="co"># Please refer to the documentation to know about the parameters herein.</span></span>
-<span id="cb21-4"><a href="#cb21-4" aria-hidden="true"></a><span class="co">#</span></span>
-<span id="cb21-5"><a href="#cb21-5" aria-hidden="true"></a><span class="co"># The `executable` parameter for all toolkits can be either the</span></span>
-<span id="cb21-6"><a href="#cb21-6" aria-hidden="true"></a><span class="co"># executable name (if it is present on the PATH), or</span></span>
-<span id="cb21-7"><a href="#cb21-7" aria-hidden="true"></a><span class="co"># the full path to the executable.</span></span>
-<span id="cb21-8"><a href="#cb21-8" aria-hidden="true"></a><span class="co"># E.g.:</span></span>
-<span id="cb21-9"><a href="#cb21-9" aria-hidden="true"></a><span class="co">#  executable: python3</span></span>
-<span id="cb21-10"><a href="#cb21-10" aria-hidden="true"></a><span class="co">#  executable: &quot;C:\Python37\Scripts\python.exe&quot;</span></span>
-<span id="cb21-11"><a href="#cb21-11" aria-hidden="true"></a></span>
-<span id="cb21-12"><a href="#cb21-12" aria-hidden="true"></a><span class="co"># The following parameters affect all toolkits</span></span>
-<span id="cb21-13"><a href="#cb21-13" aria-hidden="true"></a><span class="co"># Directory where to save the plots. The path can be relative to pandoc-plot&#39;s</span></span>
-<span id="cb21-14"><a href="#cb21-14" aria-hidden="true"></a><span class="co"># current working directory, or absolute.</span></span>
-<span id="cb21-15"><a href="#cb21-15" aria-hidden="true"></a><span class="fu">directory</span><span class="kw">:</span><span class="at"> plots/</span></span>
-<span id="cb21-16"><a href="#cb21-16" aria-hidden="true"></a></span>
-<span id="cb21-17"><a href="#cb21-17" aria-hidden="true"></a><span class="co"># Whether or not to include a link to the source script in the caption. </span></span>
-<span id="cb21-18"><a href="#cb21-18" aria-hidden="true"></a><span class="co"># Particularly useful for HTML output.</span></span>
-<span id="cb21-19"><a href="#cb21-19" aria-hidden="true"></a><span class="fu">source</span><span class="kw">:</span><span class="at"> </span><span class="ch">false</span></span>
-<span id="cb21-20"><a href="#cb21-20" aria-hidden="true"></a></span>
-<span id="cb21-21"><a href="#cb21-21" aria-hidden="true"></a><span class="co"># Default density of figures in dots per inches (DPI). </span></span>
-<span id="cb21-22"><a href="#cb21-22" aria-hidden="true"></a><span class="co"># This can be changed in the document specifically as well.</span></span>
-<span id="cb21-23"><a href="#cb21-23" aria-hidden="true"></a><span class="fu">dpi</span><span class="kw">:</span><span class="at"> </span><span class="dv">80</span></span>
-<span id="cb21-24"><a href="#cb21-24" aria-hidden="true"></a></span>
-<span id="cb21-25"><a href="#cb21-25" aria-hidden="true"></a><span class="co"># Default format in which to save the figures. This can be specified </span></span>
-<span id="cb21-26"><a href="#cb21-26" aria-hidden="true"></a><span class="co"># individually as well.</span></span>
-<span id="cb21-27"><a href="#cb21-27" aria-hidden="true"></a><span class="fu">format</span><span class="kw">:</span><span class="at"> PNG</span></span>
-<span id="cb21-28"><a href="#cb21-28" aria-hidden="true"></a></span>
-<span id="cb21-29"><a href="#cb21-29" aria-hidden="true"></a><span class="co"># Text format for the captions. Unfortunately, there is no way to detect</span></span>
-<span id="cb21-30"><a href="#cb21-30" aria-hidden="true"></a><span class="co"># this automatically. You can use the same notation as Pandoc&#39;s --from </span></span>
-<span id="cb21-31"><a href="#cb21-31" aria-hidden="true"></a><span class="co"># parameter, specified here: </span></span>
-<span id="cb21-32"><a href="#cb21-32" aria-hidden="true"></a><span class="co">#     https://pandoc.org/MANUAL.html#option--from</span></span>
-<span id="cb21-33"><a href="#cb21-33" aria-hidden="true"></a><span class="co"># Example: markdown, rst+raw_tex</span></span>
-<span id="cb21-34"><a href="#cb21-34" aria-hidden="true"></a><span class="fu">caption_format</span><span class="kw">:</span><span class="at"> markdown+tex_math_dollars</span></span>
-<span id="cb21-35"><a href="#cb21-35" aria-hidden="true"></a></span>
-<span id="cb21-36"><a href="#cb21-36" aria-hidden="true"></a><span class="co"># Logging configuration</span></span>
-<span id="cb21-37"><a href="#cb21-37" aria-hidden="true"></a><span class="fu">logging</span><span class="kw">:</span></span>
-<span id="cb21-38"><a href="#cb21-38" aria-hidden="true"></a><span class="co">  # Possible verbosity values: debug, error, warning, info, silent</span></span>
-<span id="cb21-39"><a href="#cb21-39" aria-hidden="true"></a><span class="at">  </span><span class="fu">verbosity</span><span class="kw">:</span><span class="at"> warning</span></span>
-<span id="cb21-40"><a href="#cb21-40" aria-hidden="true"></a><span class="co">  # If the filepath below is not present, then pandoc-plot will log to stderr</span></span>
-<span id="cb21-41"><a href="#cb21-41" aria-hidden="true"></a><span class="co">  # Otherwise, log messages will be appended to the filepath.</span></span>
-<span id="cb21-42"><a href="#cb21-42" aria-hidden="true"></a><span class="co">  # filepath: path/to/file.txt</span></span>
-<span id="cb21-43"><a href="#cb21-43" aria-hidden="true"></a></span>
-<span id="cb21-44"><a href="#cb21-44" aria-hidden="true"></a><span class="co"># The possible parameters for the Matplotlib toolkit</span></span>
-<span id="cb21-45"><a href="#cb21-45" aria-hidden="true"></a><span class="fu">matplotlib</span><span class="kw">:</span></span>
-<span id="cb21-46"><a href="#cb21-46" aria-hidden="true"></a><span class="co">  # preamble: matplotlib.py</span></span>
-<span id="cb21-47"><a href="#cb21-47" aria-hidden="true"></a><span class="at">  </span><span class="fu">tight_bbox</span><span class="kw">:</span><span class="at"> </span><span class="ch">false</span></span>
-<span id="cb21-48"><a href="#cb21-48" aria-hidden="true"></a><span class="at">  </span><span class="fu">transparent</span><span class="kw">:</span><span class="at"> </span><span class="ch">false</span></span>
-<span id="cb21-49"><a href="#cb21-49" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> python</span></span>
-<span id="cb21-50"><a href="#cb21-50" aria-hidden="true"></a></span>
-<span id="cb21-51"><a href="#cb21-51" aria-hidden="true"></a><span class="co"># The possible parameters for the MATLAB toolkit</span></span>
-<span id="cb21-52"><a href="#cb21-52" aria-hidden="true"></a><span class="fu">matlabplot</span><span class="kw">:</span></span>
-<span id="cb21-53"><a href="#cb21-53" aria-hidden="true"></a><span class="co">  # preamble: matlab.m</span></span>
-<span id="cb21-54"><a href="#cb21-54" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> matlab</span></span>
-<span id="cb21-55"><a href="#cb21-55" aria-hidden="true"></a></span>
-<span id="cb21-56"><a href="#cb21-56" aria-hidden="true"></a><span class="co"># The possible parameters for the Plotly/Python toolkit</span></span>
-<span id="cb21-57"><a href="#cb21-57" aria-hidden="true"></a><span class="fu">plotly_python</span><span class="kw">:</span></span>
-<span id="cb21-58"><a href="#cb21-58" aria-hidden="true"></a><span class="co">  # preamble: plotly-python.py</span></span>
-<span id="cb21-59"><a href="#cb21-59" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> python</span></span>
-<span id="cb21-60"><a href="#cb21-60" aria-hidden="true"></a></span>
-<span id="cb21-61"><a href="#cb21-61" aria-hidden="true"></a><span class="co"># The possible parameters for the Plotly/R toolkit</span></span>
-<span id="cb21-62"><a href="#cb21-62" aria-hidden="true"></a><span class="fu">plotly_r</span><span class="kw">:</span></span>
-<span id="cb21-63"><a href="#cb21-63" aria-hidden="true"></a><span class="co">  # preamble: plotly-r.r</span></span>
-<span id="cb21-64"><a href="#cb21-64" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> Rscript</span></span>
-<span id="cb21-65"><a href="#cb21-65" aria-hidden="true"></a></span>
-<span id="cb21-66"><a href="#cb21-66" aria-hidden="true"></a><span class="co"># The possible parameters for the Mathematica toolkit</span></span>
-<span id="cb21-67"><a href="#cb21-67" aria-hidden="true"></a><span class="fu">mathplot</span><span class="kw">:</span></span>
-<span id="cb21-68"><a href="#cb21-68" aria-hidden="true"></a><span class="co">  # preamble: mathematica.m</span></span>
-<span id="cb21-69"><a href="#cb21-69" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> math</span></span>
-<span id="cb21-70"><a href="#cb21-70" aria-hidden="true"></a></span>
-<span id="cb21-71"><a href="#cb21-71" aria-hidden="true"></a><span class="co"># The possible parameters for the GNU Octave toolkit</span></span>
-<span id="cb21-72"><a href="#cb21-72" aria-hidden="true"></a><span class="fu">octaveplot</span><span class="kw">:</span></span>
-<span id="cb21-73"><a href="#cb21-73" aria-hidden="true"></a><span class="co">  # preamble: octave.m</span></span>
-<span id="cb21-74"><a href="#cb21-74" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> octave</span></span>
-<span id="cb21-75"><a href="#cb21-75" aria-hidden="true"></a></span>
-<span id="cb21-76"><a href="#cb21-76" aria-hidden="true"></a><span class="co"># The possible parameters for the ggplot2 toolkit</span></span>
-<span id="cb21-77"><a href="#cb21-77" aria-hidden="true"></a><span class="fu">ggplot2</span><span class="kw">:</span></span>
-<span id="cb21-78"><a href="#cb21-78" aria-hidden="true"></a><span class="co">  # preamble: ggplot2.r</span></span>
-<span id="cb21-79"><a href="#cb21-79" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> Rscript</span></span>
-<span id="cb21-80"><a href="#cb21-80" aria-hidden="true"></a></span>
-<span id="cb21-81"><a href="#cb21-81" aria-hidden="true"></a><span class="co"># The possible parameters for the gnuplot toolkit</span></span>
-<span id="cb21-82"><a href="#cb21-82" aria-hidden="true"></a><span class="fu">gnuplot</span><span class="kw">:</span></span>
-<span id="cb21-83"><a href="#cb21-83" aria-hidden="true"></a><span class="co">  # preamble: gnuplot.gp</span></span>
-<span id="cb21-84"><a href="#cb21-84" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> gnuplot</span></span>
-<span id="cb21-85"><a href="#cb21-85" aria-hidden="true"></a></span>
-<span id="cb21-86"><a href="#cb21-86" aria-hidden="true"></a><span class="co"># The possible parameters for the graphviz toolkit</span></span>
-<span id="cb21-87"><a href="#cb21-87" aria-hidden="true"></a><span class="fu">graphviz</span><span class="kw">:</span></span>
-<span id="cb21-88"><a href="#cb21-88" aria-hidden="true"></a><span class="co">  # preamble: graphviz.dot</span></span>
-<span id="cb21-89"><a href="#cb21-89" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> dot</span></span>
-<span id="cb21-90"><a href="#cb21-90" aria-hidden="true"></a></span>
-<span id="cb21-91"><a href="#cb21-91" aria-hidden="true"></a><span class="fu">bokeh</span><span class="kw">:</span></span>
-<span id="cb21-92"><a href="#cb21-92" aria-hidden="true"></a><span class="co">  # preamble: bokeh.py</span></span>
-<span id="cb21-93"><a href="#cb21-93" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> python</span></span>
-<span id="cb21-94"><a href="#cb21-94" aria-hidden="true"></a></span>
-<span id="cb21-95"><a href="#cb21-95" aria-hidden="true"></a><span class="fu">plotsjl</span><span class="kw">:</span></span>
-<span id="cb21-96"><a href="#cb21-96" aria-hidden="true"></a><span class="co">  # preamble: plotsjl.jl</span></span>
-<span id="cb21-97"><a href="#cb21-97" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> julia</span></span></code></pre></div>
+<div class="sourceCode" id="cb22"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true"></a></span>
+<span id="cb22-2"><a href="#cb22-2" aria-hidden="true"></a><span class="co"># This is an example configuration. Everything in this file is optional.</span></span>
+<span id="cb22-3"><a href="#cb22-3" aria-hidden="true"></a><span class="co"># Please refer to the documentation to know about the parameters herein.</span></span>
+<span id="cb22-4"><a href="#cb22-4" aria-hidden="true"></a><span class="co">#</span></span>
+<span id="cb22-5"><a href="#cb22-5" aria-hidden="true"></a><span class="co"># The `executable` parameter for all toolkits can be either the</span></span>
+<span id="cb22-6"><a href="#cb22-6" aria-hidden="true"></a><span class="co"># executable name (if it is present on the PATH), or</span></span>
+<span id="cb22-7"><a href="#cb22-7" aria-hidden="true"></a><span class="co"># the full path to the executable.</span></span>
+<span id="cb22-8"><a href="#cb22-8" aria-hidden="true"></a><span class="co"># E.g.:</span></span>
+<span id="cb22-9"><a href="#cb22-9" aria-hidden="true"></a><span class="co">#  executable: python3</span></span>
+<span id="cb22-10"><a href="#cb22-10" aria-hidden="true"></a><span class="co">#  executable: &quot;C:\Python37\Scripts\python.exe&quot;</span></span>
+<span id="cb22-11"><a href="#cb22-11" aria-hidden="true"></a></span>
+<span id="cb22-12"><a href="#cb22-12" aria-hidden="true"></a><span class="co"># The following parameters affect all toolkits</span></span>
+<span id="cb22-13"><a href="#cb22-13" aria-hidden="true"></a><span class="co"># Directory where to save the plots. The path can be relative to pandoc-plot&#39;s</span></span>
+<span id="cb22-14"><a href="#cb22-14" aria-hidden="true"></a><span class="co"># current working directory, or absolute.</span></span>
+<span id="cb22-15"><a href="#cb22-15" aria-hidden="true"></a><span class="fu">directory</span><span class="kw">:</span><span class="at"> plots/</span></span>
+<span id="cb22-16"><a href="#cb22-16" aria-hidden="true"></a></span>
+<span id="cb22-17"><a href="#cb22-17" aria-hidden="true"></a><span class="co"># Whether or not to include a link to the source script in the caption. </span></span>
+<span id="cb22-18"><a href="#cb22-18" aria-hidden="true"></a><span class="co"># Particularly useful for HTML output.</span></span>
+<span id="cb22-19"><a href="#cb22-19" aria-hidden="true"></a><span class="fu">source</span><span class="kw">:</span><span class="at"> </span><span class="ch">false</span></span>
+<span id="cb22-20"><a href="#cb22-20" aria-hidden="true"></a></span>
+<span id="cb22-21"><a href="#cb22-21" aria-hidden="true"></a><span class="co"># Default density of figures in dots per inches (DPI). </span></span>
+<span id="cb22-22"><a href="#cb22-22" aria-hidden="true"></a><span class="co"># This can be changed in the document specifically as well.</span></span>
+<span id="cb22-23"><a href="#cb22-23" aria-hidden="true"></a><span class="fu">dpi</span><span class="kw">:</span><span class="at"> </span><span class="dv">80</span></span>
+<span id="cb22-24"><a href="#cb22-24" aria-hidden="true"></a></span>
+<span id="cb22-25"><a href="#cb22-25" aria-hidden="true"></a><span class="co"># Default format in which to save the figures. This can be specified </span></span>
+<span id="cb22-26"><a href="#cb22-26" aria-hidden="true"></a><span class="co"># individually as well.</span></span>
+<span id="cb22-27"><a href="#cb22-27" aria-hidden="true"></a><span class="fu">format</span><span class="kw">:</span><span class="at"> PNG</span></span>
+<span id="cb22-28"><a href="#cb22-28" aria-hidden="true"></a></span>
+<span id="cb22-29"><a href="#cb22-29" aria-hidden="true"></a><span class="co"># Text format for the captions. Unfortunately, there is no way to detect</span></span>
+<span id="cb22-30"><a href="#cb22-30" aria-hidden="true"></a><span class="co"># this automatically. You can use the same notation as Pandoc&#39;s --from </span></span>
+<span id="cb22-31"><a href="#cb22-31" aria-hidden="true"></a><span class="co"># parameter, specified here: </span></span>
+<span id="cb22-32"><a href="#cb22-32" aria-hidden="true"></a><span class="co">#     https://pandoc.org/MANUAL.html#option--from</span></span>
+<span id="cb22-33"><a href="#cb22-33" aria-hidden="true"></a><span class="co"># Example: markdown, rst+raw_tex</span></span>
+<span id="cb22-34"><a href="#cb22-34" aria-hidden="true"></a><span class="fu">caption_format</span><span class="kw">:</span><span class="at"> markdown+tex_math_dollars</span></span>
+<span id="cb22-35"><a href="#cb22-35" aria-hidden="true"></a></span>
+<span id="cb22-36"><a href="#cb22-36" aria-hidden="true"></a><span class="co"># Logging configuration</span></span>
+<span id="cb22-37"><a href="#cb22-37" aria-hidden="true"></a><span class="fu">logging</span><span class="kw">:</span></span>
+<span id="cb22-38"><a href="#cb22-38" aria-hidden="true"></a><span class="co">  # Possible verbosity values: debug, error, warning, info, silent</span></span>
+<span id="cb22-39"><a href="#cb22-39" aria-hidden="true"></a><span class="at">  </span><span class="fu">verbosity</span><span class="kw">:</span><span class="at"> warning</span></span>
+<span id="cb22-40"><a href="#cb22-40" aria-hidden="true"></a><span class="co">  # If the filepath below is not present, then pandoc-plot will log to stderr</span></span>
+<span id="cb22-41"><a href="#cb22-41" aria-hidden="true"></a><span class="co">  # Otherwise, log messages will be appended to the filepath.</span></span>
+<span id="cb22-42"><a href="#cb22-42" aria-hidden="true"></a><span class="co">  # filepath: path/to/file.txt</span></span>
+<span id="cb22-43"><a href="#cb22-43" aria-hidden="true"></a></span>
+<span id="cb22-44"><a href="#cb22-44" aria-hidden="true"></a><span class="co"># The possible parameters for the Matplotlib toolkit</span></span>
+<span id="cb22-45"><a href="#cb22-45" aria-hidden="true"></a><span class="fu">matplotlib</span><span class="kw">:</span></span>
+<span id="cb22-46"><a href="#cb22-46" aria-hidden="true"></a><span class="co">  # preamble: matplotlib.py</span></span>
+<span id="cb22-47"><a href="#cb22-47" aria-hidden="true"></a><span class="at">  </span><span class="fu">tight_bbox</span><span class="kw">:</span><span class="at"> </span><span class="ch">false</span></span>
+<span id="cb22-48"><a href="#cb22-48" aria-hidden="true"></a><span class="at">  </span><span class="fu">transparent</span><span class="kw">:</span><span class="at"> </span><span class="ch">false</span></span>
+<span id="cb22-49"><a href="#cb22-49" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> python</span></span>
+<span id="cb22-50"><a href="#cb22-50" aria-hidden="true"></a></span>
+<span id="cb22-51"><a href="#cb22-51" aria-hidden="true"></a><span class="co"># The possible parameters for the MATLAB toolkit</span></span>
+<span id="cb22-52"><a href="#cb22-52" aria-hidden="true"></a><span class="fu">matlabplot</span><span class="kw">:</span></span>
+<span id="cb22-53"><a href="#cb22-53" aria-hidden="true"></a><span class="co">  # preamble: matlab.m</span></span>
+<span id="cb22-54"><a href="#cb22-54" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> matlab</span></span>
+<span id="cb22-55"><a href="#cb22-55" aria-hidden="true"></a></span>
+<span id="cb22-56"><a href="#cb22-56" aria-hidden="true"></a><span class="co"># The possible parameters for the Plotly/Python toolkit</span></span>
+<span id="cb22-57"><a href="#cb22-57" aria-hidden="true"></a><span class="fu">plotly_python</span><span class="kw">:</span></span>
+<span id="cb22-58"><a href="#cb22-58" aria-hidden="true"></a><span class="co">  # preamble: plotly-python.py</span></span>
+<span id="cb22-59"><a href="#cb22-59" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> python</span></span>
+<span id="cb22-60"><a href="#cb22-60" aria-hidden="true"></a></span>
+<span id="cb22-61"><a href="#cb22-61" aria-hidden="true"></a><span class="co"># The possible parameters for the Plotly/R toolkit</span></span>
+<span id="cb22-62"><a href="#cb22-62" aria-hidden="true"></a><span class="fu">plotly_r</span><span class="kw">:</span></span>
+<span id="cb22-63"><a href="#cb22-63" aria-hidden="true"></a><span class="co">  # preamble: plotly-r.r</span></span>
+<span id="cb22-64"><a href="#cb22-64" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> Rscript</span></span>
+<span id="cb22-65"><a href="#cb22-65" aria-hidden="true"></a></span>
+<span id="cb22-66"><a href="#cb22-66" aria-hidden="true"></a><span class="co"># The possible parameters for the Mathematica toolkit</span></span>
+<span id="cb22-67"><a href="#cb22-67" aria-hidden="true"></a><span class="fu">mathplot</span><span class="kw">:</span></span>
+<span id="cb22-68"><a href="#cb22-68" aria-hidden="true"></a><span class="co">  # preamble: mathematica.m</span></span>
+<span id="cb22-69"><a href="#cb22-69" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> math</span></span>
+<span id="cb22-70"><a href="#cb22-70" aria-hidden="true"></a></span>
+<span id="cb22-71"><a href="#cb22-71" aria-hidden="true"></a><span class="co"># The possible parameters for the GNU Octave toolkit</span></span>
+<span id="cb22-72"><a href="#cb22-72" aria-hidden="true"></a><span class="fu">octaveplot</span><span class="kw">:</span></span>
+<span id="cb22-73"><a href="#cb22-73" aria-hidden="true"></a><span class="co">  # preamble: octave.m</span></span>
+<span id="cb22-74"><a href="#cb22-74" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> octave</span></span>
+<span id="cb22-75"><a href="#cb22-75" aria-hidden="true"></a></span>
+<span id="cb22-76"><a href="#cb22-76" aria-hidden="true"></a><span class="co"># The possible parameters for the ggplot2 toolkit</span></span>
+<span id="cb22-77"><a href="#cb22-77" aria-hidden="true"></a><span class="fu">ggplot2</span><span class="kw">:</span></span>
+<span id="cb22-78"><a href="#cb22-78" aria-hidden="true"></a><span class="co">  # preamble: ggplot2.r</span></span>
+<span id="cb22-79"><a href="#cb22-79" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> Rscript</span></span>
+<span id="cb22-80"><a href="#cb22-80" aria-hidden="true"></a></span>
+<span id="cb22-81"><a href="#cb22-81" aria-hidden="true"></a><span class="co"># The possible parameters for the gnuplot toolkit</span></span>
+<span id="cb22-82"><a href="#cb22-82" aria-hidden="true"></a><span class="fu">gnuplot</span><span class="kw">:</span></span>
+<span id="cb22-83"><a href="#cb22-83" aria-hidden="true"></a><span class="co">  # preamble: gnuplot.gp</span></span>
+<span id="cb22-84"><a href="#cb22-84" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> gnuplot</span></span>
+<span id="cb22-85"><a href="#cb22-85" aria-hidden="true"></a></span>
+<span id="cb22-86"><a href="#cb22-86" aria-hidden="true"></a><span class="co"># The possible parameters for the graphviz toolkit</span></span>
+<span id="cb22-87"><a href="#cb22-87" aria-hidden="true"></a><span class="fu">graphviz</span><span class="kw">:</span></span>
+<span id="cb22-88"><a href="#cb22-88" aria-hidden="true"></a><span class="co">  # preamble: graphviz.dot</span></span>
+<span id="cb22-89"><a href="#cb22-89" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> dot</span></span>
+<span id="cb22-90"><a href="#cb22-90" aria-hidden="true"></a></span>
+<span id="cb22-91"><a href="#cb22-91" aria-hidden="true"></a><span class="fu">bokeh</span><span class="kw">:</span></span>
+<span id="cb22-92"><a href="#cb22-92" aria-hidden="true"></a><span class="co">  # preamble: bokeh.py</span></span>
+<span id="cb22-93"><a href="#cb22-93" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> python</span></span>
+<span id="cb22-94"><a href="#cb22-94" aria-hidden="true"></a></span>
+<span id="cb22-95"><a href="#cb22-95" aria-hidden="true"></a><span class="fu">plotsjl</span><span class="kw">:</span></span>
+<span id="cb22-96"><a href="#cb22-96" aria-hidden="true"></a><span class="co">  # preamble: plotsjl.jl</span></span>
+<span id="cb22-97"><a href="#cb22-97" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> julia</span></span></code></pre></div>
 <p>A file like the above sets the <strong>default</strong> values; you can still override them in documents directly.</p>
 <p>The easiest way to specify configuration for <code>pandoc-plot</code> is to place a <code>.pandoc-plot.yml</code> file in the current working directory. You can also specify a configuration file in document metadata, under the <code>plot-configuration</code> key. For example, in Markdown:</p>
-<div class="sourceCode" id="cb22"><pre class="sourceCode markdown"><code class="sourceCode markdown"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true"></a><span class="co">---</span></span>
-<span id="cb22-2"><a href="#cb22-2" aria-hidden="true"></a><span class="an">title:</span><span class="co"> My document</span></span>
-<span id="cb22-3"><a href="#cb22-3" aria-hidden="true"></a><span class="an">author:</span><span class="co"> John Doe</span></span>
-<span id="cb22-4"><a href="#cb22-4" aria-hidden="true"></a><span class="an">plot-configuration:</span><span class="co"> /path/to/file.yml</span></span>
-<span id="cb22-5"><a href="#cb22-5" aria-hidden="true"></a><span class="co">---</span></span></code></pre></div>
+<div class="sourceCode" id="cb23"><pre class="sourceCode markdown"><code class="sourceCode markdown"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true"></a><span class="co">---</span></span>
+<span id="cb23-2"><a href="#cb23-2" aria-hidden="true"></a><span class="an">title:</span><span class="co"> My document</span></span>
+<span id="cb23-3"><a href="#cb23-3" aria-hidden="true"></a><span class="an">author:</span><span class="co"> John Doe</span></span>
+<span id="cb23-4"><a href="#cb23-4" aria-hidden="true"></a><span class="an">plot-configuration:</span><span class="co"> /path/to/file.yml</span></span>
+<span id="cb23-5"><a href="#cb23-5" aria-hidden="true"></a><span class="co">---</span></span></code></pre></div>
 <p>or on the command line, using the pandoc <code>-M/--metadata</code> flag:</p>
-<div class="sourceCode" id="cb23"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true"></a><span class="ex">pandoc</span> --filter pandoc-plot -M plot-configuration=/path/to/file.yml ...</span></code></pre></div>
+<div class="sourceCode" id="cb24"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true"></a><span class="ex">pandoc</span> --filter pandoc-plot -M plot-configuration=/path/to/file.yml ...</span></code></pre></div>
 <p>The hierarchy of configuration files is as follows:</p>
 <ol type="1">
 <li>A configuration file specified in the metadata under the <code>plot-configuration</code> key;</li>
@@ -393,10 +399,10 @@ <h4 id="executables">Executables</h4>
 <p>The <code>executable</code> parameter for all toolkits can be either the executable name (if it is present on the PATH), or the full path to the executable.</p>
 <p>Examples:</p>
-<div class="sourceCode" id="cb24"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true"></a><span class="fu">matplotlib</span><span class="kw">:</span></span>
-<span id="cb24-2"><a href="#cb24-2" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> python3</span></span></code></pre></div>
-<div class="sourceCode" id="cb25"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true"></a><span class="fu">matlabplot</span><span class="kw">:</span></span>
-<span id="cb25-2"><a href="#cb25-2" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> </span><span class="st">&quot;C:\Program Files\Matlab\R2019b</span><span class="sc">\b</span><span class="st">in\matlab.exe&quot;</span></span></code></pre></div>
+<div class="sourceCode" id="cb25"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true"></a><span class="fu">matplotlib</span><span class="kw">:</span></span>
+<span id="cb25-2"><a href="#cb25-2" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> python3</span></span></code></pre></div>
+<div class="sourceCode" id="cb26"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb26-1"><a href="#cb26-1" aria-hidden="true"></a><span class="fu">matlabplot</span><span class="kw">:</span></span>
+<span id="cb26-2"><a href="#cb26-2" aria-hidden="true"></a><span class="at">  </span><span class="fu">executable</span><span class="kw">:</span><span class="at"> </span><span class="st">&quot;C:\Program Files\Matlab\R2019b</span><span class="sc">\b</span><span class="st">in\matlab.exe&quot;</span></span></code></pre></div>
 <h4 id="toolkit-specific-options">Toolkit-specific options</h4>
 <h5 id="matplotlib">Matplotlib</h5>
 <ul>
@@ -405,49 +411,49 @@ </ul>
 <h4 id="logging">Logging</h4>
 <p>If you are running <code>pandoc-plot</code> on a large document, you might want to turn on logging. You can do so via the configuration file as follows:</p>
-<div class="sourceCode" id="cb26"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb26-1"><a href="#cb26-1" aria-hidden="true"></a><span class="fu">logging</span><span class="kw">:</span></span>
-<span id="cb26-2"><a href="#cb26-2" aria-hidden="true"></a><span class="co">    # Possible verbosity values: debug, error, warning, info, silent</span></span>
-<span id="cb26-3"><a href="#cb26-3" aria-hidden="true"></a><span class="co">    # debug level shows all messages</span></span>
-<span id="cb26-4"><a href="#cb26-4" aria-hidden="true"></a><span class="co">    # error level shows all but debug messages, etc.</span></span>
-<span id="cb26-5"><a href="#cb26-5" aria-hidden="true"></a><span class="at">    </span><span class="fu">verbosity</span><span class="kw">:</span><span class="at"> info</span></span>
-<span id="cb26-6"><a href="#cb26-6" aria-hidden="true"></a><span class="at">    </span></span>
-<span id="cb26-7"><a href="#cb26-7" aria-hidden="true"></a><span class="co">    # OPTIONAL: log to file</span></span>
-<span id="cb26-8"><a href="#cb26-8" aria-hidden="true"></a><span class="co">    # Remove line below to log to stderr</span></span>
-<span id="cb26-9"><a href="#cb26-9" aria-hidden="true"></a><span class="at">    </span><span class="fu">filepath</span><span class="kw">:</span><span class="at"> log.txt</span></span></code></pre></div>
+<div class="sourceCode" id="cb27"><pre class="sourceCode yaml"><code class="sourceCode yaml"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true"></a><span class="fu">logging</span><span class="kw">:</span></span>
+<span id="cb27-2"><a href="#cb27-2" aria-hidden="true"></a><span class="co">    # Possible verbosity values: debug, error, warning, info, silent</span></span>
+<span id="cb27-3"><a href="#cb27-3" aria-hidden="true"></a><span class="co">    # debug level shows all messages</span></span>
+<span id="cb27-4"><a href="#cb27-4" aria-hidden="true"></a><span class="co">    # error level shows all but debug messages, etc.</span></span>
+<span id="cb27-5"><a href="#cb27-5" aria-hidden="true"></a><span class="at">    </span><span class="fu">verbosity</span><span class="kw">:</span><span class="at"> info</span></span>
+<span id="cb27-6"><a href="#cb27-6" aria-hidden="true"></a><span class="at">    </span></span>
+<span id="cb27-7"><a href="#cb27-7" aria-hidden="true"></a><span class="co">    # OPTIONAL: log to file</span></span>
+<span id="cb27-8"><a href="#cb27-8" aria-hidden="true"></a><span class="co">    # Remove line below to log to stderr</span></span>
+<span id="cb27-9"><a href="#cb27-9" aria-hidden="true"></a><span class="at">    </span><span class="fu">filepath</span><span class="kw">:</span><span class="at"> log.txt</span></span></code></pre></div>
 <p>By default, <code>pandoc-plot</code> logs warnings and errors to the standard error stream only.</p>
 <h3 id="other-commands">Other commands</h3>
 <h4 id="finding-installed-toolkits">Finding installed toolkits</h4>
 <p>You can determine which toolkits are available on your current machine using the <code>pandoc-plot toolkits</code> command. Here is the full help text:</p>
-<div class="sourceCode" id="cb27"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true"></a><span class="ex">Usage</span>: pandoc-plot.EXE toolkits [--config PATH]</span>
-<span id="cb27-2"><a href="#cb27-2" aria-hidden="true"></a>  <span class="ex">Show</span> information on toolkits and exit.</span>
-<span id="cb27-3"><a href="#cb27-3" aria-hidden="true"></a></span>
-<span id="cb27-4"><a href="#cb27-4" aria-hidden="true"></a><span class="ex">Available</span> options:</span>
-<span id="cb27-5"><a href="#cb27-5" aria-hidden="true"></a>  <span class="ex">--config</span> PATH            Path to optional configuration file.</span>
-<span id="cb27-6"><a href="#cb27-6" aria-hidden="true"></a>  <span class="ex">-h</span>,--help                Show this help text</span></code></pre></div>
+<div class="sourceCode" id="cb28"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb28-1"><a href="#cb28-1" aria-hidden="true"></a><span class="ex">Usage</span>: pandoc-plot.EXE toolkits [--config PATH]</span>
+<span id="cb28-2"><a href="#cb28-2" aria-hidden="true"></a>  <span class="ex">Show</span> information on toolkits and exit.</span>
+<span id="cb28-3"><a href="#cb28-3" aria-hidden="true"></a></span>
+<span id="cb28-4"><a href="#cb28-4" aria-hidden="true"></a><span class="ex">Available</span> options:</span>
+<span id="cb28-5"><a href="#cb28-5" aria-hidden="true"></a>  <span class="ex">--config</span> PATH            Path to optional configuration file.</span>
+<span id="cb28-6"><a href="#cb28-6" aria-hidden="true"></a>  <span class="ex">-h</span>,--help                Show this help text</span></code></pre></div>
 <h4 id="cleaning-output">Cleaning output</h4>
 <p>Figures produced by <code>pandoc-plot</code> can be placed in a few different locations. You can set a default location in the <a href="#configuration">Configuration</a>, but you can also re-direct specific figures in other directories if you use the <code>directory=...</code> argument in code blocks. These figures will build up over time. You can use the <code>clean</code> command to scan documents and delete the associated <code>pandoc-plot</code> output files. For example, to delete the figures generated from the <code>input.md</code> file:</p>
-<div class="sourceCode" id="cb28"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb28-1"><a href="#cb28-1" aria-hidden="true"></a><span class="ex">pandoc-plot</span> clean input.md</span></code></pre></div>
+<div class="sourceCode" id="cb29"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb29-1"><a href="#cb29-1" aria-hidden="true"></a><span class="ex">pandoc-plot</span> clean input.md</span></code></pre></div>
 <p>This sill remove all directories where a figure <em>could</em> have been placed. <strong>WARNING</strong>: all files will be removed.</p>
 <p>Here is the full help text for the <code>clean</code> command:</p>
-<div class="sourceCode" id="cb29"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb29-1"><a href="#cb29-1" aria-hidden="true"></a><span class="ex">Usage</span>: pandoc-plot.EXE clean [--config PATH] FILE</span>
-<span id="cb29-2"><a href="#cb29-2" aria-hidden="true"></a>  <span class="ex">Clean</span> output directories where figures from FILE and log files might be</span>
-<span id="cb29-3"><a href="#cb29-3" aria-hidden="true"></a>  <span class="ex">stored.</span> WARNING: All files in those directories will be deleted.</span>
-<span id="cb29-4"><a href="#cb29-4" aria-hidden="true"></a></span>
-<span id="cb29-5"><a href="#cb29-5" aria-hidden="true"></a><span class="ex">Available</span> options:</span>
-<span id="cb29-6"><a href="#cb29-6" aria-hidden="true"></a>  <span class="ex">--config</span> PATH            Path to optional configuration file.</span>
-<span id="cb29-7"><a href="#cb29-7" aria-hidden="true"></a>  <span class="ex">-h</span>,--help                Show this help text</span></code></pre></div>
+<div class="sourceCode" id="cb30"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb30-1"><a href="#cb30-1" aria-hidden="true"></a><span class="ex">Usage</span>: pandoc-plot.EXE clean [--config PATH] FILE</span>
+<span id="cb30-2"><a href="#cb30-2" aria-hidden="true"></a>  <span class="ex">Clean</span> output directories where figures from FILE and log files might be</span>
+<span id="cb30-3"><a href="#cb30-3" aria-hidden="true"></a>  <span class="ex">stored.</span> WARNING: All files in those directories will be deleted.</span>
+<span id="cb30-4"><a href="#cb30-4" aria-hidden="true"></a></span>
+<span id="cb30-5"><a href="#cb30-5" aria-hidden="true"></a><span class="ex">Available</span> options:</span>
+<span id="cb30-6"><a href="#cb30-6" aria-hidden="true"></a>  <span class="ex">--config</span> PATH            Path to optional configuration file.</span>
+<span id="cb30-7"><a href="#cb30-7" aria-hidden="true"></a>  <span class="ex">-h</span>,--help                Show this help text</span></code></pre></div>
 <h4 id="configuration-template">Configuration template</h4>
 <p>Because <code>pandoc-plot</code> supports a few toolkits, there are a lot of configuration options. Don’t start from scratch! The <code>write-example-config</code> command will create a file for you, which you can then modify:</p>
-<div class="sourceCode" id="cb30"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb30-1"><a href="#cb30-1" aria-hidden="true"></a><span class="ex">pandoc-plot</span> write-example-config</span></code></pre></div>
+<div class="sourceCode" id="cb31"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb31-1"><a href="#cb31-1" aria-hidden="true"></a><span class="ex">pandoc-plot</span> write-example-config</span></code></pre></div>
 <p>You will need to re-name the file to <code>.pandoc-ploy.yml</code> to be able to use it, so don’t worry about overwriting your own configuration.</p>
 <p>Here is the full help text for the <code>write-example-config</code> command:</p>
-<div class="sourceCode" id="cb31"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb31-1"><a href="#cb31-1" aria-hidden="true"></a><span class="ex">Usage</span>: pandoc-plot.EXE write-example-config [--path FILE]</span>
-<span id="cb31-2"><a href="#cb31-2" aria-hidden="true"></a>  <span class="ex">Write</span> example configuration to a file and exit.</span>
-<span id="cb31-3"><a href="#cb31-3" aria-hidden="true"></a></span>
-<span id="cb31-4"><a href="#cb31-4" aria-hidden="true"></a><span class="ex">Available</span> options:</span>
-<span id="cb31-5"><a href="#cb31-5" aria-hidden="true"></a>  <span class="ex">--path</span> FILE              Target location of the configuration file. Default is</span>
-<span id="cb31-6"><a href="#cb31-6" aria-hidden="true"></a>                           <span class="st">&quot;.example-pandoc-plot.yml&quot;</span></span>
-<span id="cb31-7"><a href="#cb31-7" aria-hidden="true"></a>  <span class="ex">-h</span>,--help                Show this help text</span></code></pre></div>
+<div class="sourceCode" id="cb32"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb32-1"><a href="#cb32-1" aria-hidden="true"></a><span class="ex">Usage</span>: pandoc-plot.EXE write-example-config [--path FILE]</span>
+<span id="cb32-2"><a href="#cb32-2" aria-hidden="true"></a>  <span class="ex">Write</span> example configuration to a file and exit.</span>
+<span id="cb32-3"><a href="#cb32-3" aria-hidden="true"></a></span>
+<span id="cb32-4"><a href="#cb32-4" aria-hidden="true"></a><span class="ex">Available</span> options:</span>
+<span id="cb32-5"><a href="#cb32-5" aria-hidden="true"></a>  <span class="ex">--path</span> FILE              Target location of the configuration file. Default is</span>
+<span id="cb32-6"><a href="#cb32-6" aria-hidden="true"></a>                           <span class="st">&quot;.example-pandoc-plot.yml&quot;</span></span>
+<span id="cb32-7"><a href="#cb32-7" aria-hidden="true"></a>  <span class="ex">-h</span>,--help                Show this help text</span></code></pre></div>
 <h2 id="warning">Warning</h2>
 <p>Do not run this filter on unknown documents. There is nothing in
 <code>pandoc-plot</code> that can stop a script from performing <strong>evil actions</strong>.</p>
executable/Main.hs view
@@ -29,8 +29,8 @@                                                    plotTransform,
                                                    defaultConfiguration, 
                                                    configuration, Configuration(..),
-                                                   pandocPlotVersion)
-import           Text.Pandoc.Filter.Plot.Internal (cls, supportedSaveFormats, 
+                                                   pandocPlotVersion, cls, 
+                                                   supportedSaveFormats, 
                                                    toolkits, readDoc, 
                                                    cleanOutputDirs, 
                                                    configurationPathMeta,
@@ -252,7 +252,10 @@ clean mfp fp = do
     doc <- readDoc fp
     -- Note the priority for configuration:
-    -- (1) path of argument --config (2) document metadata (3) local .pandoc-plot.yml (4) default config
+    --   (1) path of argument --config 
+    --   (2) document metadata 
+    --   (3) local .pandoc-plot.yml 
+    --   (4) default config
     conf <- maybe localConfig configuration $ firstJusts [configurationPathMeta doc, mfp]
     putStrLn $ "Cleaning output directories for " <> fp
     cleanedDirs <- cleanOutputDirs conf doc
pandoc-plot.cabal view
@@ -1,6 +1,6 @@ cabal-version:  2.2
 name:           pandoc-plot
-version:        0.8.0.0
+version:        0.8.1.0
 synopsis:       A Pandoc filter to include figures generated from code blocks using your plotting toolkit of choice.
 description:    A Pandoc filter to include figures generated from code blocks. Keep the document and code in the same location. Output is captured and included as a figure.
 category:       Text
@@ -29,9 +29,9 @@ library
     exposed-modules:
         Text.Pandoc.Filter.Plot
-        Text.Pandoc.Filter.Plot.Internal
     other-modules:
         Paths_pandoc_plot
+        Text.Pandoc.Filter.Plot.Internal
         Text.Pandoc.Filter.Plot.Clean
         Text.Pandoc.Filter.Plot.Configuration
         Text.Pandoc.Filter.Plot.Parse
@@ -52,6 +52,7 @@         Text.Pandoc.Filter.Plot.Monad
         Text.Pandoc.Filter.Plot.Monad.Logging
         Text.Pandoc.Filter.Plot.Monad.Types
+        Text.Pandoc.Filter.Plot.Embed
     autogen-modules:
         Paths_pandoc_plot
     hs-source-dirs:
@@ -63,13 +64,15 @@           base               >= 4.11  && <5
         , bytestring
         , containers
+        , data-default  
         , directory          >= 1.2.7 && < 2
         , filepath           >= 1.4   && < 2
         , hashable           >= 1     && < 2
         , pandoc             >= 2.10  && < 3
-        , pandoc-types       >= 1.21  && < 2
+        , pandoc-types       >= 1.21  && < 1.22
         , lifted-async       >= 0.10  && < 1
         , shakespeare        >= 2.0   && < 3
+        , tagsoup            >= 0.14  && < 1
         , text               >= 1     && < 2
         , typed-process      >= 0.2.1 && < 1
         , yaml               >= 0.8   && < 1
src/Text/Pandoc/Filter/Plot.hs view
@@ -82,15 +82,32 @@     , SaveFormat(..)
     , Script
     -- * Determining available plotting toolkits
+    , Toolkit(..)
     , availableToolkits
     , unavailableToolkits
+    , toolkits
+    , supportedSaveFormats
     -- * Version information
     , pandocPlotVersion
     -- * For testing and internal purposes ONLY
+    -- ** Running the @PlotM@ monad
     , make
     , makeEither
+    , PlotM
+    , runPlotM
     , PandocPlotError(..)
+    -- ** Code block parameters
+    , InclusionKey(..)
+    , inclusionKeys
+    -- ** Utilities
+    , extension
     , readDoc
+    , captionReader
+    , cls
+    , configurationPathMeta
+    , executable
+    -- ** Embedding HTML content
+    , extractPlot
     ) where
 
 import Control.Concurrent.Async.Lifted   (mapConcurrently)
@@ -161,7 +178,7 @@         handleResult _ (ScriptFailure msg code)       = return $ Left (ScriptRuntimeError msg code) 
         handleResult _ (ScriptChecksFailed msg)       = return $ Left (ScriptChecksFailedError msg)
         handleResult _ (ToolkitNotInstalled tk')      = return $ Left (ToolkitNotInstalledError tk') 
-        handleResult spec ScriptSuccess = asks envConfig >>= \c -> return $ Right $ toImage (captionFormat c) spec
+        handleResult spec ScriptSuccess = asks envConfig >>= \c -> Right <$> toFigure (captionFormat c) spec
 
 
 data PandocPlotError
src/Text/Pandoc/Filter/Plot/Clean.hs view
@@ -22,6 +22,7 @@ 
 import qualified Data.ByteString.Lazy             as B
 import           Data.Char                        (toLower)
+import           Data.Default                     (def)
 import           Data.List                        (nub)
 import           Data.Maybe                       (fromMaybe, catMaybes)
 
@@ -64,13 +65,13 @@         removeDir d = removePathForcibly d >> return d
 
 
--- | Read document, guessing what extensions and reader options are appropriate. If
+-- | Read a document, guessing what extensions and reader options are appropriate. If
 -- the file cannot be read for any reason, an error is thrown.
 readDoc :: FilePath -> IO Pandoc
 readDoc fp = handleError =<< (runIO $ do
         let fmt = fromMaybe mempty (formatFromFilePath fp)
         (reader, exts) <- P.getReader fmt
-        let readerOpts = defaultReaderOptions {P.readerExtensions = exts}
+        let readerOpts = def {P.readerExtensions = exts}
         case reader of 
             P.TextReader fct -> do
                 t <- liftIO $ Text.readFile fp 
+ src/Text/Pandoc/Filter/Plot/Embed.hs view
@@ -0,0 +1,117 @@+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE QuasiQuotes       #-}
+{-|
+Module      : $header$
+Copyright   : (c) Laurent P René de Cotret, 2020
+License     : GNU GPL, version 2 or above
+Maintainer  : laurent.decotret@outlook.com
+Stability   : internal
+Portability : portable
+
+Embedding HTML content
+-}
+
+module Text.Pandoc.Filter.Plot.Embed (
+      extractPlot
+    , toFigure
+) where
+
+import           Data.Default                      (def)
+import           Data.Maybe                        (fromMaybe)
+import           Data.Text                         (Text, pack)
+import qualified Data.Text.IO                      as T
+
+import           System.FilePath                   (replaceExtension)
+
+import           Text.HTML.TagSoup
+
+import           Text.Pandoc.Builder               (fromList, imageWith, link,
+                                                    para, toList, Inlines)
+import           Text.Pandoc.Class                 (runPure)
+import           Text.Pandoc.Definition            (Pandoc(..), Block (..), Format, Attr)
+import           Text.Pandoc.Error                 (handleError)
+import           Text.Pandoc.Writers.HTML          (writeHtml5String)
+
+import           Text.Pandoc.Filter.Plot.Parse     (captionReader)
+import           Text.Pandoc.Filter.Plot.Monad
+import           Text.Pandoc.Filter.Plot.Scripting (figurePath)
+
+import           Text.Shakespeare.Text             (st)
+
+
+-- | Convert a @FigureSpec@ to a Pandoc figure component.
+-- Note that the script to generate figure files must still
+-- be run in another function.
+toFigure :: Format       -- ^ text format of the caption
+         -> FigureSpec 
+         -> PlotM Block
+toFigure fmt spec = builder attrs' target' caption'
+    where
+        builder      = if saveFormat spec == HTML
+                        then interactiveBlock
+                        else figure
+        attrs'       = blockAttrs spec
+        target'      = figurePath spec
+        withSource'  = withSource spec
+        srcLink      = link (pack $ replaceExtension target' ".txt") mempty "Source code"
+        captionText  = fromList $ fromMaybe mempty (captionReader fmt $ caption spec)
+        captionLinks = mconcat [" (", srcLink, ")"]
+        caption'     = if withSource' then captionText <> captionLinks else captionText
+
+
+figure :: Attr
+       -> FilePath
+       -> Inlines
+       -> PlotM Block
+-- To render images as figures with captions, the target title
+-- must be "fig:"
+-- Janky? yes
+figure as fp caption' = return . head . toList . para $ 
+                       imageWith as (pack fp) "fig:" caption'
+
+
+interactiveBlock :: Attr
+                 -> FilePath
+                 -> Inlines
+                 -> PlotM Block
+interactiveBlock _ fp caption' = do
+    htmlpage <- liftIO $ T.readFile fp
+    renderedCaption <- writeHtml caption'
+    return $ RawBlock "html5" [st|
+<figure>
+    <div>
+    #{extractPlot htmlpage}
+    </div>
+    <figcaption>#{renderedCaption}</figcaption>
+</figure>
+    |]
+
+
+-- | Convert Pandoc inlines to html
+writeHtml :: Inlines -> PlotM Text
+writeHtml is = liftIO $ handleError $ runPure $ writeHtml5String def document
+    where
+        document = Pandoc mempty [Para . toList $ is]
+
+
+-- | Extract the plot-relevant content from inside of a full HTML document.
+-- Scripts contained in the <head> tag are extracted, as well as the entirety of the
+-- <body> tag.
+extractPlot :: Text -> Text
+extractPlot t = let tags = canonicalizeTags $ parseTagsOptions parseOptionsFast t  
+                in mconcat $ renderTags <$> (headScripts tags <> [htmlBody tags])
+    where
+        headScripts = partitions (~== ("<script>"::String)) . htmlHead
+
+inside :: Text -> [Tag Text] -> [Tag Text]
+inside t = init . tail . tgs
+    where
+        tgs = takeWhile (~/= TagClose t) . dropWhile (~/= TagOpen t [])
+
+
+htmlHead :: [Tag Text] -> [Tag Text]
+htmlHead = inside "head"
+
+
+htmlBody :: [Tag Text] -> [Tag Text]
+htmlBody = inside "body"
src/Text/Pandoc/Filter/Plot/Internal.hs view
@@ -18,6 +18,7 @@     , module Text.Pandoc.Filter.Plot.Configuration
     , module Text.Pandoc.Filter.Plot.Clean
     , module Text.Pandoc.Filter.Plot.Monad
+    , module Text.Pandoc.Filter.Plot.Embed
  ) where
 
 import Text.Pandoc.Filter.Plot.Parse
@@ -25,4 +26,5 @@ import Text.Pandoc.Filter.Plot.Scripting
 import Text.Pandoc.Filter.Plot.Configuration
 import Text.Pandoc.Filter.Plot.Clean
-import Text.Pandoc.Filter.Plot.Monad+import Text.Pandoc.Filter.Plot.Monad
+import Text.Pandoc.Filter.Plot.Embed
src/Text/Pandoc/Filter/Plot/Monad.hs view
@@ -29,6 +29,7 @@     , ask
     , asks
     , asksConfig
+    , silence
     -- * Base types
     , module Text.Pandoc.Filter.Plot.Monad.Types
 ) where
@@ -66,6 +67,12 @@                , envLogger :: Logger
                }
 
+
+-- | Modify the runtime environment to be silent.
+silence :: PlotM a -> PlotM a
+silence = local (\(RuntimeEnv c l) -> RuntimeEnv c l{lVerbosity = Silent})
+
+
 -- | Get access to configuration within the @PlotM@ monad.
 asksConfig :: (Configuration -> a) -> PlotM a
 asksConfig f = asks (f . envConfig)
@@ -102,7 +109,8 @@ 
 -- | Run a command within the @PlotM@ monad. Stderr stream
 -- is read and decoded, while Stdout is ignored. 
--- Logging happens at the debug level.
+-- Logging happens at the debug level if the command succeeds, or at
+-- the error level if it does not succeed..
 runCommand :: Text -> PlotM (ExitCode, Text)
 runCommand command = do
     (ec, processOutput') <- liftIO 
@@ -111,12 +119,21 @@                         $ setStderr byteStringOutput 
                         $ shell (unpack command)
     let processOutput = decodeUtf8With lenientDecode $ toStrict processOutput'
-    debug $ mconcat [ "Running command\n"
-                    , "    ", command, "\n"
-                    , "ended with exit code ", pack . show $ ec
-                    ,  if processOutput /= mempty then (" and output\n" <> "    " <> processOutput) else mempty
-                    , "\n"
-                    ] 
+        logFunc = if ec == ExitSuccess
+                    then debug
+                    else err
+        message = T.unlines [ "Running command"
+                            , "    " <> command
+                            , "ended with exit code " <> (pack . show $ ec)
+                            ] 
+        errorMessage = if processOutput == mempty 
+            then mempty 
+            else T.unlines [ "*******"
+                           , processOutput
+                           , "*******"
+                           ]
+    
+    logFunc $ message <> errorMessage
     return (ec, processOutput)
 
 
src/Text/Pandoc/Filter/Plot/Monad/Types.hs view
@@ -42,7 +42,7 @@ 
 import           Text.Pandoc.Definition (Attr)
 
-
+-- | List of supported toolkits.
 toolkits :: [Toolkit]
 toolkits = enumFromTo minBound maxBound
 
@@ -93,6 +93,7 @@ cls Plotsjl      = "plotsjl"
 
 
+-- | Source context for plotting scripts
 type Script = Text
 
 
src/Text/Pandoc/Filter/Plot/Parse.hs view
@@ -19,11 +19,11 @@       plotToolkit
     , parseFigureSpec
     , captionReader
-    , defaultReaderOptions
 ) where
 
 import           Control.Monad                     (join, when)
 
+import           Data.Default                      (def)
 import           Data.List                         (intersperse)
 import qualified Data.Map.Strict                   as Map
 import           Data.Maybe                        (fromMaybe, listToMaybe)
@@ -40,8 +40,7 @@                                                     Pandoc (..), Format(..))
 
 import           Text.Pandoc.Class                 (runPure)
-import           Text.Pandoc.Extensions            (emptyExtensions)
-import           Text.Pandoc.Options               (ReaderOptions (..), TrackChanges(..))
+import           Text.Pandoc.Options               (ReaderOptions (..))
 import           Text.Pandoc.Readers               (getReader, Reader(..))
 
 import           Text.Pandoc.Filter.Plot.Renderers
@@ -115,7 +114,7 @@ captionReader :: Format -> Text -> Maybe [Inline]
 captionReader (Format f) t = either (const Nothing) (Just . extractFromBlocks) $ runPure $ do
     (reader, exts) <- getReader f
-    let readerOpts = defaultReaderOptions {readerExtensions = exts}
+    let readerOpts = def {readerExtensions = exts}
     -- Assuming no ByteString readers...
     case reader of
         TextReader fct -> fct readerOpts t
@@ -133,20 +132,4 @@ readBool :: Text -> Bool
 readBool s | s `elem` ["True",  "true",  "'True'",  "'true'",  "1"] = True
            | s `elem` ["False", "false", "'False'", "'false'", "0"] = False
-           | otherwise = error $ unpack $ mconcat ["Could not parse '", s, "' into a boolean. Please use 'True' or 'False'"]
-
-
--- | Default reader options, straight out of Text.Pandoc.Options
-defaultReaderOptions :: ReaderOptions
-defaultReaderOptions = 
-    ReaderOptions
-        { readerExtensions            = emptyExtensions
-        , readerStandalone            = False
-        , readerColumns               = 80
-        , readerTabStop               = 4
-        , readerIndentedCodeClasses   = []
-        , readerAbbreviations         = mempty
-        , readerDefaultImageExtension = ""
-        , readerTrackChanges          = AcceptChanges
-        , readerStripComments         = False
-        }+           | otherwise = error $ unpack $ mconcat ["Could not parse '", s, "' into a boolean. Please use 'True' or 'False'"]
src/Text/Pandoc/Filter/Plot/Renderers.hs view
@@ -65,7 +65,7 @@ scriptExtension GNUPlot      = ".gp"
 scriptExtension Graphviz     = ".dot"
 scriptExtension Bokeh        = ".py"
-scriptExtension Plotsjl   = ".jl"
+scriptExtension Plotsjl      = ".jl"
 
 
 -- Make a string into a comment
@@ -80,7 +80,7 @@ comment GNUPlot      = mappend "# "
 comment Graphviz     = mappend "// "
 comment Bokeh        = mappend "# "
-comment Plotsjl   = mappend "# "
+comment Plotsjl      = mappend "# "
 
 
 -- | The function that maps from configuration to the preamble.
@@ -95,7 +95,7 @@ preambleSelector GNUPlot      = gnuplotPreamble
 preambleSelector Graphviz     = graphvizPreamble
 preambleSelector Bokeh        = bokehPreamble
-preambleSelector Plotsjl   = plotsjlPreamble
+preambleSelector Plotsjl      = plotsjlPreamble
 
 
 -- | Save formats supported by this renderer.
@@ -110,7 +110,7 @@ supportedSaveFormats GNUPlot      = gnuplotSupportedSaveFormats
 supportedSaveFormats Graphviz     = graphvizSupportedSaveFormats
 supportedSaveFormats Bokeh        = bokehSupportedSaveFormats
-supportedSaveFormats Plotsjl   = plotsjlSupportedSaveFormats
+supportedSaveFormats Plotsjl      = plotsjlSupportedSaveFormats
 
 
 -- Checks to perform before running a script. If ANY check fails,
@@ -144,7 +144,7 @@ command GNUPlot      = gnuplotCommand
 command Graphviz     = graphvizCommand
 command Bokeh        = bokehCommand
-command Plotsjl   = plotsjlCommand
+command Plotsjl      = plotsjlCommand
 
 
 -- | Script fragment required to capture a figure.
@@ -159,7 +159,7 @@ capture GNUPlot      = gnuplotCapture
 capture Graphviz     = graphvizCapture 
 capture Bokeh        = bokehCapture
-capture Plotsjl   = plotsjlCapture
+capture Plotsjl      = plotsjlCapture
 
 
 -- | Check if a toolkit is available, based on the current configuration
@@ -174,7 +174,7 @@ toolkitAvailable GNUPlot      = gnuplotAvailable
 toolkitAvailable Graphviz     = graphvizAvailable
 toolkitAvailable Bokeh        = bokehAvailable
-toolkitAvailable Plotsjl   = plotsjlAvailable
+toolkitAvailable Plotsjl      = plotsjlAvailable
 
 
 -- | List of toolkits available on this machine.
@@ -190,8 +190,10 @@ 
 
 -- | Monadic version of @availableToolkits@.
+--
+-- Note that logging is disabled
 availableToolkitsM :: PlotM [Toolkit]
-availableToolkitsM = do
+availableToolkitsM = silence $ do
     mtks <- forConcurrently toolkits $  \tk -> do
         available <- toolkitAvailable tk
         if available
src/Text/Pandoc/Filter/Plot/Renderers/Bokeh.hs view
@@ -62,12 +62,12 @@ bokehCapture FigureSpec{..} fname = [st|
 from bokeh.io import export_png, export_svgs, save
 from bokeh.models import Plot
-from bokeh.resources import INLINE
+from bokeh.resources import CDN
 __current_plot = next(obj for obj in globals().values() if isinstance(obj, Plot))
 #{write}
 |]
     where  
         write = case saveFormat of
-            HTML -> [st|save(__current_plot, filename=r"#{fname}", resources=INLINE)|]
+            HTML -> [st|save(__current_plot, filename=r"#{fname}", resources=CDN)|]
             PNG  -> [st|export_png(obj = __current_plot, filename=r"#{fname}")|]
             fmt  -> error $ "Save format not supported: " <> show fmt
src/Text/Pandoc/Filter/Plot/Renderers/PlotlyPython.hs view
@@ -38,12 +38,11 @@     exe <- executable PlotlyPython
     commandSuccess [st|#{exe} -c "import plotly.graph_objects"|]
 
-
 plotlyPythonCapture :: FigureSpec -> FilePath -> Script
 plotlyPythonCapture FigureSpec{..} fname = [st|
 import plotly.graph_objects as go
 __current_plotly_figure = next(obj for obj in globals().values() if type(obj) == go.Figure)
-__current_plotly_figure.#{write_method}(r"#{fname}")
+__current_plotly_figure.#{write_method}(r"#{fname}"#{extra_args})
 |]
     where
         -- Note: the default behaviour for HTML export is
@@ -51,4 +50,7 @@         --       that the resulting file can be used completely offline   
         write_method = case saveFormat of
             HTML -> "write_html"::Text
-            _    -> "write_image"::Text
+            _    -> "write_image"
+        extra_args = case saveFormat of
+            HTML -> ", include_plotlyjs='cdn'"::Text
+            _    -> mempty
src/Text/Pandoc/Filter/Plot/Scripting.hs view
@@ -16,13 +16,12 @@     ( ScriptResult(..)
     , runTempScript
     , runScriptIfNecessary
-    , toImage
+    , figurePath
     ) where
 
 import           Control.Monad.Reader
 
 import           Data.Hashable                     (hash)
-import           Data.Maybe                        (fromMaybe)
 import           Data.Text                         (Text, pack, unpack)
 import qualified Data.Text.IO                      as T
 
@@ -33,11 +32,6 @@                                                     normalise, replaceExtension,
                                                     takeDirectory, (</>))
 
-import           Text.Pandoc.Builder               (fromList, imageWith, link,
-                                                    para, toList)
-import           Text.Pandoc.Definition            (Block (..), Format)
-
-import           Text.Pandoc.Filter.Plot.Parse     (captionReader)
 import           Text.Pandoc.Filter.Plot.Renderers
 import           Text.Pandoc.Filter.Plot.Monad
 
@@ -113,36 +107,6 @@                     if toolkitInstalled
                         then return $ ScriptFailure command_ code
                         else return $ ToolkitNotInstalled toolkit
-
-
--- | Convert a @FigureSpec@ to a Pandoc block component.
--- Note that the script to generate figure files must still
--- be run in another function.
-toImage :: Format       -- ^ text format of the caption
-        -> FigureSpec 
-        -> Block
-toImage fmt spec = head . toList $ para $ imageWith attrs' (pack target') "fig:" caption'
-    -- To render images as figures with captions, the target title
-    -- must be "fig:"
-    -- Janky? yes
-    where
-        attrs'       = withInteractiveAttrs $ blockAttrs spec
-        target'      = figurePath spec
-        withSource'  = withSource spec
-        srcLink      = link (pack $ replaceExtension target' ".txt") mempty "Source code"
-        captionText  = fromList $ fromMaybe mempty (captionReader fmt $ caption spec)
-        captionLinks = mconcat [" (", srcLink, ")"]
-        caption'     = if withSource' then captionText <> captionLinks else captionText
-        -- for HTML plots, pandoc will replace the <img> tag with an <embed> tag
-        -- We include extra attributes with the <embed> tag in mind.
-        -- TODO: find way to have HTML "figure" full-width without hardcoding width
-        withInteractiveAttrs (a, b, c) = 
-            if saveFormat spec == HTML
-                then (a, b, c <> [ ("type", "text/html")
-                                    , ("width", "600")
-                                    , ("height", "600")
-                                    ])
-                else (a, b, c)
 
 
 -- | Determine the temp script path from Figure specifications
stack.yaml view
@@ -8,8 +8,8 @@ - hslua-1.1.2@sha256:6c231b2af447430d1ed04f065d40bb6882ece93cc7f32f4051dc99deb69beeae,9694
 - jira-wiki-markup-1.3.2@sha256:b5f0901208a0ee07aff60f5356aeb851b7aa7950c75a18a15fd34247a35886d8,3819
 # For development
-- git: https://github.com/LaurentRDC/pandoc-include-code.git
-  commit: 162ae92edc80601bde8450bf933c0127e8c2b53a
+- git: https://github.com/owickstrom/pandoc-include-code.git
+  commit: d5cbdc86eb1abcd9561c0965ac423d7011378ddb
 - ghc-check-0.3.0.1@sha256:651d9b2b75a5cbdb3c942117801bfa566079bcaf20360e4d0959f9e575c30b39,1070
   
 # Faster compilation.
tests/Common.hs view
@@ -15,7 +15,6 @@ import           Test.Tasty.HUnit
 
 import           Text.Pandoc.Filter.Plot
-import           Text.Pandoc.Filter.Plot.Internal
 
 import qualified Text.Pandoc.Builder              as B
 import qualified Text.Pandoc.Definition           as B
tests/Main.hs view
@@ -5,6 +5,7 @@ 
 import qualified Data.Map.Strict                  as Map
 import           Data.Text                        (Text, unpack)
+import qualified Data.Text                        as T
 
 import           Test.Tasty
 import           Test.Tasty.HUnit
@@ -14,7 +15,7 @@ import           Text.Pandoc.JSON
 
 import           Common
-import           Text.Pandoc.Filter.Plot.Internal
+import           Text.Pandoc.Filter.Plot
 
 main :: IO ()
 main = do
@@ -34,6 +35,11 @@             "Parsing tests"
             [ testCaptionReader ]
         , testGroup
+            "HTML embedding tests"
+            [ testHtmlBodyEmbedding
+            , testHtmlEmbedding 
+            ]
+        , testGroup
             "Toolkit tests"
             (toolkitSuite <$> available)
         ]
@@ -104,4 +110,46 @@             fmt = B.Format "markdown+tex_math_dollars"
             parsed = captionReader fmt caption
 
-        assertEqual "" expected parsed+        assertEqual "" expected parsed
+
+
+testHtmlBodyEmbedding :: TestTree
+testHtmlBodyEmbedding = 
+    testCase "HTML body can be extracted from file" $ do
+        let html=T.unlines ["<!DOCTYPE html>"
+                           ,"<html lang=\"en\">"
+                           ,"  <head>"
+                           ,"    <meta charset=\"utf-8\">"
+                           ,"    <title>title</title>"
+                           ,"    <link rel=\"stylesheet\" href=\"style.css\">"
+                           ,"  </head>"
+                           ,"  <body>"
+                           ,"    <p>Hello</p>"
+                           ,"  </body>"
+                           ,"</html>"
+                           ]
+            extracted = extractPlot html
+            expected = "\n    <p>Hello</p>"
+
+        assertEqual "" expected extracted 
+
+testHtmlEmbedding :: TestTree
+testHtmlEmbedding = 
+    testCase "HTML body and head scripts can be extracted from file" $ do
+        let html=T.unlines ["<!DOCTYPE html>"
+                           ,"<html lang=\"en\">"
+                           ,"  <head>"
+                           ,"    <meta charset=\"utf-8\">"
+                           ,"    <title>title</title>"
+                           ,"    <link rel=\"stylesheet\" href=\"style.css\">"
+                           ,"    <script src=\"script.js\"></script>"
+                           ,"  </head>"
+                           ,"  <body>"
+                           ,"    <p>Hello</p>"
+                           ,"  </body>"
+                           ,"</html>"
+                           ]
+            extracted = extractPlot html
+            expected = "<script src=\"script.js\"></script>\n    <p>Hello</p>"
+
+        assertEqual "" expected extracted