patat 0.15.0.0 → 0.15.1.0
raw patch · 5 files changed
+63/−4 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Patat.Presentation.Internal: [evalSyntax] :: EvalSettings -> !Maybe Text
+ Patat.Presentation.Settings: [evalSyntax] :: EvalSettings -> !Maybe Text
- Patat.Presentation.Internal: EvalSettings :: !Text -> !Bool -> !Bool -> !EvalSettingsContainer -> !Bool -> EvalSettings
+ Patat.Presentation.Internal: EvalSettings :: !Text -> !Bool -> !Bool -> !EvalSettingsContainer -> !Bool -> !Maybe Text -> EvalSettings
- Patat.Presentation.Settings: EvalSettings :: !Text -> !Bool -> !Bool -> !EvalSettingsContainer -> !Bool -> EvalSettings
+ Patat.Presentation.Settings: EvalSettings :: !Text -> !Bool -> !Bool -> !EvalSettingsContainer -> !Bool -> !Maybe Text -> EvalSettings
- Patat.Presentation.Syntax: dftBlocks :: forall m. Monad m => (Block -> m [Block]) -> (Inline -> m [Inline]) -> [Block] -> m [Block]
+ Patat.Presentation.Syntax: dftBlocks :: Monad m => (Block -> m [Block]) -> (Inline -> m [Inline]) -> [Block] -> m [Block]
- Patat.Presentation.Syntax: dftInlines :: forall m. Monad m => (Block -> m [Block]) -> (Inline -> m [Inline]) -> [Inline] -> m [Inline]
+ Patat.Presentation.Syntax: dftInlines :: Monad m => (Block -> m [Block]) -> (Inline -> m [Inline]) -> [Inline] -> m [Inline]
- Patat.Transition.Internal: [Transition] :: FromJSON conf => (conf -> TransitionGen) -> Transition
+ Patat.Transition.Internal: [Transition] :: forall conf. FromJSON conf => (conf -> TransitionGen) -> Transition
Files
- CHANGELOG.md +20/−0
- README.md +33/−2
- lib/Patat/Eval/Internal.hs +7/−1
- lib/Patat/Presentation/Settings.hs +2/−0
- patat.cabal +1/−1
CHANGELOG.md view
@@ -1,5 +1,25 @@ # Changelog +## 0.15.1.0 (2025-04-26)++ * Add a `syntax` option for `eval` blocks (#187). This allows you to set+ the syntax highlighting to be used for the _output of the evaluated code_,+ for example:++ ---+ patat:+ eval:+ ruby:+ command: irb --noecho --noverbose+ syntax: json+ ...++ Here is a code block:++ ```ruby+ puts '{"hello": "world"}'+ ```+ ## 0.15.0.0 (2025-04-05) * Add [OSC8] support for hyperlinks (#185). This makes hyperlinks clickable
README.md view
@@ -719,12 +719,13 @@ reveal: true # Optional replace: false # Optional container: code # Optional+ syntax: json # Optional ... Here is an example of a code block that is evaluated: ```ruby- puts "Hi"+ puts '{"hello": "world"}' ``` An arbitrary amount of evaluators can be specified, and whenever a a class@@ -734,7 +735,7 @@ code of presentations downloaded from the internet before running them if they contain `eval` settings. -Aside from the command, there are four more options:+Aside from the command, there are five more options: - `reveal`: Introduce a pause (see [fragments](#fragmented-slides)) in between showing the original code block and the output. Defaults to `true`.@@ -746,11 +747,41 @@ * `code`: the default setting. * `none`: no formatting applied. * `inline`: no formatting applied and no trailing newline.+ - `syntax`: When using `container: code` (the default), the output of the eval+ block will use the same syntax highlighting as the input code block.+ You can customize this using `syntax`, e.g. `syntax: json`. - `stderr`: Include output from standard error. Defaults to `true`.+ - `wrap`: this is a deprecated name for `container`, used in version 0.11 and earlier. - `fragment`: this is a deprecated name for `reveal`, used in version 0.13 and earlier.++Note that it is possible to set multiple classes on a codeblock by using pandoc+fenced code block syntax. This allows you to to separate syntax highlighting+from evaluation. You can use this to only evaluate certain snippets, or even+evaluate using different commands or settings:++ ---+ patat:+ eval:+ python2:+ command: python2+ python3:+ command: python3+ ...++ Snippet evaluated using an old python version:++ ~~~{.python .python2}+ print "Hello, world"+ ~~~++ Snippet evaluated using a more recent python version:++ ~~~{.python .python3}+ print("Hello, world")+ ~~~ Setting `reveal: false` and `replace: true` offers a way to "filter" code blocks, which can be used to render ASCII graphics.
lib/Patat/Eval/Internal.hs view
@@ -33,8 +33,14 @@ -------------------------------------------------------------------------------- renderEvalBlock :: EvalBlock -> T.Text -> [Block] renderEvalBlock EvalBlock {..} out = case evalContainer ebSettings of- EvalContainerCode -> [CodeBlock ebAttr out]+ EvalContainerCode -> [CodeBlock ("", classes, []) out] EvalContainerNone -> [RawBlock fmt out] EvalContainerInline -> [Plain [RawInline fmt out]] where fmt = "eval"++ -- The classes for the new code block are copied from the old one if+ -- unspecified, or the syntax specified in the eval settings.+ classes = case evalSyntax ebSettings of+ Nothing -> let (_, cs, _) = ebAttr in cs+ Just outSyntax -> [outSyntax]
lib/Patat/Presentation/Settings.hs view
@@ -257,6 +257,7 @@ , evalReveal :: !Bool , evalContainer :: !EvalSettingsContainer , evalStderr :: !Bool+ , evalSyntax :: !(Maybe T.Text) } deriving (Eq, Show) @@ -268,6 +269,7 @@ <*> deprecated "fragment" "reveal" True o <*> deprecated "wrap" "container" EvalContainerCode o <*> o A..:? "stderr" A..!= True+ <*> o A..:? "syntax" where deprecated old new def obj = do mo <- obj A..:? old
patat.cabal view
@@ -1,5 +1,5 @@ Name: patat-Version: 0.15.0.0+Version: 0.15.1.0 Synopsis: Terminal-based presentations using Pandoc Description: Terminal-based presentations using Pandoc. License: GPL-2