diff options
| author | Albert Krewinkel <albert@zeitkraut.de> | 2022-08-21 21:44:41 +0200 |
|---|---|---|
| committer | Albert Krewinkel <albert@zeitkraut.de> | 2022-08-21 21:53:33 +0200 |
| commit | 5d6616608858e60641676a7fa76a87f9516d477d (patch) | |
| tree | 4fadfb1a339ad4b08e05bbf692858b0ac45d14fb /src | |
| parent | e483bc9ff7b19f5db7fb6b5dd1947e33ec35a5ce (diff) | |
Org reader: treat *emacs-jupyter* src blocks as code cells.
This improves support for notebook-like org files that are intended to be used
with emacs-jupyter package.
Closes: #8236
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Readers/Org/Blocks.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Org/Blocks.hs b/src/Text/Pandoc/Readers/Org/Blocks.hs index dd79cc289..baf244d81 100644 --- a/src/Text/Pandoc/Readers/Org/Blocks.hs +++ b/src/Text/Pandoc/Readers/Org/Blocks.hs @@ -311,7 +311,11 @@ codeBlock blockAttrs blockType = do content <- rawBlockContent blockType resultsContent <- option mempty babelResultsBlock let identifier = fromMaybe mempty $ blockAttrName blockAttrs - let codeBlk = B.codeBlockWith (identifier, classes, kv) content + let classes' = case classes of + c:cs | Just c' <- T.stripPrefix "jupyter-" c -> + c' : "code" : cs + _ -> classes + let codeBlk = B.codeBlockWith (identifier, classes', kv) content let wrap = maybe pure addCaption (blockAttrCaption blockAttrs) return $ (if exportsCode kv then wrap codeBlk else mempty) <> |
