Top Related Projects
The HTML Presentation Framework
Terminal based presentation tool
Persists tmux environment across system restarts.
Presentation Ninja 幻灯忍者 · 写轮眼
A simple, in-browser, markdown-driven slideshow tool.
Quick Overview
Patat (Presentations Atop The ANSI Terminal) is a command-line tool for creating and presenting terminal-based slideshows. It allows users to write presentations in Markdown and display them directly in the terminal, offering a lightweight and versatile alternative to traditional presentation software.
Pros
- Simple and lightweight, requiring no external dependencies
- Supports Markdown syntax for easy content creation
- Offers customizable themes and syntax highlighting
- Works well in remote environments or systems without graphical interfaces
Cons
- Limited visual formatting options compared to graphical presentation tools
- May not be suitable for presentations requiring complex animations or multimedia
- Learning curve for users unfamiliar with terminal-based applications
- Potential compatibility issues with certain terminal emulators
Getting Started
- Install patat using Homebrew (macOS) or your system's package manager:
brew install patat
- Create a Markdown file for your presentation:
---
title: My Presentation
author: Your Name
---
# Slide 1
- Point 1
- Point 2
---
# Slide 2
Some content here
- Run the presentation:
patat your_presentation.md
- Use arrow keys to navigate slides, and press 'q' to quit.
Competitor Comparisons
The HTML Presentation Framework
Pros of reveal.js
- Rich, interactive web-based presentations with animations and transitions
- Extensive theming and customization options
- Large community and ecosystem of plugins
Cons of reveal.js
- Requires more setup and configuration
- Steeper learning curve for non-developers
- Larger file size and potential performance impact for complex presentations
Code Comparison
reveal.js (HTML):
<div class="reveal">
<div class="slides">
<section>Slide 1</section>
<section>Slide 2</section>
</div>
</div>
patat (Markdown):
# Slide 1
---
# Slide 2
Key Differences
- patat uses simple Markdown syntax, making it easier for non-technical users
- reveal.js offers more advanced features and interactivity
- patat is terminal-based, while reveal.js creates web presentations
- reveal.js has a larger community and more extensive documentation
- patat is lightweight and requires minimal setup
Use Cases
- Choose patat for quick, simple presentations in terminal environments
- Opt for reveal.js when creating visually rich, interactive web presentations
Both tools have their strengths, and the choice depends on the specific needs of the presenter and the target audience.
Terminal based presentation tool
Pros of slides
- Written in Go, potentially offering better performance and easier installation
- Supports live reloading, allowing for real-time updates during presentations
- Includes a built-in timer feature for better time management
Cons of slides
- Less mature project with fewer features compared to patat
- Limited customization options for themes and styles
- May lack some advanced formatting capabilities present in patat
Code Comparison
patat:
main :: IO ()
main = do
opts <- execParser optsInfo
case opts of
Opts filePath slideNum -> do
contents <- T.readFile filePath
let slides = parseSlides contents
runSlideshow opts slides
slides:
func main() {
app := &cli.App{
Name: "slides",
Usage: "Terminal based presentation tool",
Action: func(c *cli.Context) error {
return run(c)
},
}
app.Run(os.Args)
}
Both projects aim to create terminal-based presentation tools, but they differ in implementation language and specific features. patat, written in Haskell, offers a more established and feature-rich solution, while slides, implemented in Go, provides a newer alternative with some unique capabilities like live reloading and a built-in timer.
Persists tmux environment across system restarts.
Pros of tmux-resurrect
- Specifically designed for tmux session management and restoration
- Integrates seamlessly with tmux, preserving complex window and pane layouts
- Supports restoring running programs and shell history
Cons of tmux-resurrect
- Limited to tmux functionality, not a general-purpose presentation tool
- Requires tmux knowledge and setup, which may be complex for new users
- Doesn't support formatting or styling of content within tmux panes
Code Comparison
tmux-resurrect:
# Save tmux session
tmux-resurrect save
# Restore tmux session
tmux-resurrect restore
patat:
# Run a presentation
patat presentation.md
# Run with specific options
patat --watch --auto-advance presentation.md
Summary
tmux-resurrect is a powerful tool for managing and restoring tmux sessions, ideal for users who heavily rely on tmux for their workflow. It excels in preserving complex terminal setups but is limited to tmux functionality.
patat, on the other hand, is a terminal-based presentation tool that focuses on displaying formatted content from Markdown files. It offers more flexibility in terms of content presentation but lacks the session management capabilities of tmux-resurrect.
The choice between these tools depends on the specific use case: tmux-resurrect for advanced tmux users needing session persistence, and patat for those seeking a simple, terminal-based presentation solution.
Presentation Ninja 幻灯忍者 · 写轮眼
Pros of xaringan
- Rich set of features for creating interactive and visually appealing presentations
- Seamless integration with R Markdown and knitr for data-driven slides
- Active community and extensive documentation
Cons of xaringan
- Steeper learning curve, especially for those unfamiliar with R
- Requires a web browser for viewing presentations
Code comparison
xaringan:
---
title: "My Presentation"
output:
xaringan::moon_reader:
css: [default, metropolis, metropolis-fonts]
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
---
patat:
---
title: My Presentation
author: John Doe
---
# Slide 1
- Point 1
- Point 2
---
# Slide 2
Some content here
xaringan offers more customization options in its YAML header, while patat has a simpler configuration. xaringan's syntax is geared towards R Markdown users, whereas patat uses standard Markdown syntax.
Both tools serve different purposes: xaringan is ideal for creating web-based presentations with advanced features, while patat is better suited for simple, terminal-based presentations.
A simple, in-browser, markdown-driven slideshow tool.
Pros of remark
- Web-based presentation tool, allowing for easy sharing and online viewing
- Supports live preview and real-time editing
- Extensive plugin ecosystem for additional features and customization
Cons of remark
- Requires a web browser to run presentations
- May have a steeper learning curve for users unfamiliar with web technologies
- Potentially less suitable for offline or low-connectivity environments
Code comparison
patat:
main :: IO ()
main = do
opts <- execParser optsInfo
case opts of
Patat filePath -> runPatat filePath
Version -> putStrLn $ "patat " ++ version
remark:
var slideshow = remark.create({
source: "# My Presentation\n\n---\n\n## Slide 1\n\nContent here",
ratio: '16:9',
highlightStyle: 'monokai'
});
Summary
patat is a terminal-based presentation tool written in Haskell, while remark is a web-based presentation framework using JavaScript. patat offers simplicity and works well in terminal environments, whereas remark provides a more feature-rich experience with web technologies. The choice between them depends on the user's specific needs and preferences for presentation delivery.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
ð¥ patat
patat
(Presentations Atop The ANSI Terminal) is a
feature-rich presentation tool that runs in the terminal.
- Understands most markdown extensions and many other input formats (rST, Org-mode...) by building on top of Pandoc.
- Evaluate code snippets and show the result.
- Syntax highlighting for nearly one hundred languages generated from Kate syntax files.
- Automatically reload your slides as you edit them.
- Display speaker notes in a second window or monitor.
- Incremental slide display.
- Experimental images support.
- Transition effects.
- Supports smart slide splitting.
- Auto advancing with configurable delay.
- Centering and re-wrapping text to terminal width with proper indentation.
- Theming support including 24-bit RGB.
- Highly portable as it only requires an ANSI terminal as opposed to
something like
ncurses
.
Table of Contents
Installation
Pre-built packages
Linux:
Mac OS:
You can also find generic Linux and Mac OS binaries here: https://github.com/jaspervdj/patat/releases.
From source
Installation from source is very easy. You can build from source using stack install
or cabal install
. patat
is also available from Hackage.
For people unfamiliar with the Haskell ecosystem, this means you can do either of the following:
Using stack
- Install stack for your platform.
- Clone this repository.
- Run
stack setup
(if you're running stack for the first time) andstack install
. - Make sure
$HOME/.local/bin
is in your$PATH
.
Using cabal
- Install cabal for your platform.
- Run
cabal install patat
. - Make sure
$HOME/.cabal/bin
is in your$PATH
.
Running
patat [*options*] file
Options
-w
, --watch
: If you provide the --watch
flag, patat
will watch the presentation file
for changes and reload automatically. This is very useful when you are
writing the presentation.
-f
, --force
: Run the presentation even if the terminal claims it does not support ANSI features.
-d
, --dump
: Just dump all the slides to stdout. This is useful for debugging.
--version
: Display version information.
Controls
- Next slide:
space
,enter
,l
,â
,PageDown
- Previous slide:
backspace
,h
,â
,PageUp
- Go forward 10 slides:
j
,â
- Go backward 10 slides:
k
,â
- First slide:
0
- Last slide:
G
- Jump to slide N:
N
followed byenter
- Reload file:
r
- Quit:
q
The r
key is very useful since it allows you to preview your slides while you
are writing them. You can also use this to fix artifacts when the terminal is
resized.
Input format
The input format can be anything that Pandoc supports. Plain markdown is usually the most simple solution:
---
title: This is my presentation
author: Jane Doe
...
# This is a slide
Slide contents. Yay.
---
# Important title
Things I like:
- Markdown
- Haskell
- Pandoc
Horizontal rulers (---
) are used to split slides.
However, if you prefer not use these since they are a bit intrusive in the markdown, you can also start every slide with a header. In that case, the file should not contain a single horizontal ruler.
patat
will pick the most deeply nested header (e.g. h2
) as the marker for a
new slide. Headers above the most deeply nested header (e.g. h1
) will turn
into title slides, which are displayed as as a slide containing only the
centered title.
This means the following document is equivalent to the one we saw before:
---
title: This is my presentation
author: Jane Doe
...
# This is a slide
Slide contents. Yay.
# Important title
Things I like:
- Markdown
- Haskell
- Pandoc
And that following document contains three slides: a title slide, followed by two content slides.
---
title: This is my presentation
author: Jane Doe
...
# Chapter 1
## This is a slide
Slide contents. Yay.
## Another slide
Things I like:
- Markdown
- Haskell
- Pandoc
For more information, see Advanced slide splitting.
Configuration
patat
is fairly configurable. The configuration is done using YAML. There
are several places where you can put your configuration.
-
For per-user configuration you can use
$XDG_CONFIG_DIRECTORY/patat/config.yaml
(typically$HOME/.config/patat/config.yaml
) or$HOME/.patat.yaml
, for example:slideNumber: false
-
In the presentation file itself, using the Pandoc metadata header. These settings take precedence over anything specified in the per-user configuration file. They must be placed in a
patat:
section, so they don't conflict with metadata:--- title: Presentation with options author: John Doe patat: slideNumber: false ... Hello world.
-
In version 0.10 and later slides can be individually configured. Within a slide, using a comment starting with
<!--config:
. These settings can override configuration for that specific slide only. There should not be any whitespace between<!--
andconfig:
.# First slide Slide numbers are turned on here. # Second slide <!--config: slideNumber: false --> Slide numbers are turned off here.
The following settings can not be set in a slide configuration block, and doing so will result in an error:
autoAdvanceDelay
eval
images
incrementalLists
pandocExtensions
slideLevel
speakerNotes
Line wrapping
Line wrapping can be enabled by setting wrap: true
in the configuration. This
will re-wrap all lines to fit the terminal width better. You can also ask patat
to wrap at a specific column using wrap: number
, e.g. wrap: 60
.
Tab stop
In version 0.12 and later, the amount of spaces a \t
character in a code block
aligns to can be customized by setting tabStop: number
in the configuration.
The default is 4
.
Margins
Margins can be enabled by setting a margins
entry in the configuration:
---
title: Presentation with margins
author: John Doe
patat:
wrap: true
margins:
left: 10
right: 10
top: 5
...
Lorem ipsum dolor sit amet, ...
This example configuration will generate slides with a margin of 10 columns on the left, and it will wrap long lines 10 columns before the right side of the terminal. Additionally, there will be 5 empty lines in between the title bar and slide content.
Line wrapping should be enabled when using non-zero right
margin.
By default, the left
and right
margin are set to 0, and the top
margin is
set to 1.
Centering
Version 0.11 and later can center content.
- To vertically center content, use
top: auto
. - To horizontally center content, use both
left: auto
andright: auto
.
For example:
---
title: Centered presentation
author: John Doe
patat:
margins:
left: auto
right: auto
top: auto
...
Hello world
Line wrapping is recommended when vertically centering content if there are any lines that are too wide for the terminal.
Auto advancing
By setting autoAdvanceDelay
to a number of seconds, patat
will automatically
advance to the next slide.
---
title: Auto-advance, yes please
author: John Doe
patat:
autoAdvanceDelay: 2
...
Hello World!
---
This slide will be shown two seconds after the presentation starts.
Note that changes to autoAdvanceDelay
are not picked up automatically if you
are running patat --watch
. This requires restarting patat
.
Advanced slide splitting
You can control the way slide splitting works by setting the slideLevel
variable. This variable defaults to the least header that occurs before a
non-header, but it can also be explicitly defined. For example, in the
following document, the slideLevel
defaults to 2:
# This is a slide
## This is a nested header
This is some content
With slideLevel
2, the h1
will turn into a "title slide", and the h2
will
be displayed at the top of the second slide. We can customize this by setting
slideLevel
manually:
---
patat:
slideLevel: 1
...
# This is a slide
## This is a nested header
This is some content
Now, we will only see one slide, which contains a nested header.
Fragmented slides
By default, slides are always displayed "all at once". If you want to display them fragment by fragment, there are two ways to do that. The most common case is that lists should be displayed incrementally.
This can be configured by settings incrementalLists
to true
in the metadata
block:
---
title: Presentation with incremental lists
author: John Doe
patat:
incrementalLists: true
...
- This list
- is displayed
- item by item
Setting incrementalLists
works on all lists in the presentation. To flip
the setting for a specific list, wrap it in a block quote. This will make the
list incremental if incrementalLists
is not set, and it will display the list
all at once if incrementalLists
is set to true
.
This example contains a sublist which is also displayed incrementally, and then a sublist which is displayed all at once (by merit of the block quote).
---
title: Presentation with incremental lists
author: John Doe
patat:
incrementalLists: true
...
- This list
- is displayed
* item
* by item
- Or sometimes
> * all at
> * once
Another way to break up slides is to use a pagraph only containing three dots separated by spaces. For example, this slide has two pauses:
Legen
. . .
wait for it
. . .
Dary!
Theming
Colors and other properties can also be changed using this configuration. For example, we can have:
---
author: 'Jasper Van der Jeugt'
title: 'This is a test'
patat:
wrap: true
theme:
emph: [vividBlue, onVividBlack, italic]
strong: [bold]
imageTarget: [onDullWhite, vividRed]
...
# This is a presentation
This is _emph_ text.
![Hello](foo.png)
The properties that can be given a list of styles are:
blockQuote
, borders
, bulletList
, codeBlock
, code
, definitionList
,
definitionTerm
, emph
, header
, imageTarget
, imageText
, linkTarget
,
linkText
, math
, orderedList
, quoted
, strikeout
, strong
,
tableHeader
, tableSeparator
, underline
The accepted styles are:
bold
, italic
, dullBlack
, dullBlue
, dullCyan
, dullGreen
,
dullMagenta
, dullRed
, dullWhite
, dullYellow
, onDullBlack
,
onDullBlue
, onDullCyan
, onDullGreen
, onDullMagenta
, onDullRed
,
onDullWhite
, onDullYellow
, onVividBlack
, onVividBlue
, onVividCyan
,
onVividGreen
, onVividMagenta
, onVividRed
, onVividWhite
, onVividYellow
,
underline
, vividBlack
, vividBlue
, vividCyan
, vividGreen
,
vividMagenta
, vividRed
, vividWhite
, vividYellow
Also accepted are styles of the form rgb#RrGgBb
and onRgb#RrGgBb
, where Rr
Gg
and Bb
are hexadecimal bytes (e.g. rgb#f08000
for an orange foreground,
and onRgb#101060
for a deep purple background). Naturally, your terminal
needs to support 24-bit RGB for this to work. When creating portable
presentations, it might be better to stick with the named colours listed above.
Syntax Highlighting
patat
uses Kate Syntax Highlighting files. patat
ships with support for
nearly one hundred languages thanks to Pandoc. However, if your language is
not yet available, you can add the highlighting XML file in the settings:
---
patat:
syntaxDefinitions:
- 'impurescript.xml'
...
...
As part of theming, syntax highlighting is also configurable. This can be configured like this:
---
patat:
theme:
syntaxHighlighting:
decVal: [bold, onDullRed]
...
...
decVal
refers to "decimal values". This is known as a "token type". For a
full list of token types, see this list -- the names are derived from there in
an obvious way.
Note that in order to get syntax highlighting to work, you should annotate code blocks with the language, e.g. using a fenced code block:
```ruby
puts "Hello, world!"
```
Pandoc Extensions
Pandoc comes with a fair number of extensions on top of markdown, listed here.
patat
enables a number of them by default, but this is also customizable.
In order to enable an additional extensions, e.g. autolink_bare_uris
, add it
to the pandocExtensions
field in the YAML metadata:
---
patat:
pandocExtensions:
- patat_extensions
- autolink_bare_uris
...
Document content...
The patat_extensions
in the above snippet refers to the default set of
extensions enabled by patat
. If you want to disable those and only use a
select few extensions, simply leave it out and choose your own:
---
patat:
pandocExtensions:
- autolink_bare_uris
- emoji
...
Document content...
If you don't want to enable any extensions, simply set pandocExtensions
to the
empty list []
.
Images
Native Images support
Version 0.8 and later include images support for some terminal emulators.
---
patat:
images:
backend: auto
...
# A slide with only an image.
![](matterhorn.jpg)
patat
can display full-size images on slides. For this to work images
must be enabled in the configuration and the slide needs to contain only a single image and no other content. The image will be centered and resized to fit the terminal window.
images
is off by default in the configuration.
patat
supports the following image drawing backends:
-
backend: iterm2
: uses iTerm2's special escape sequence to render the image. This even works with animated GIFs! -
backend: kitty
: uses Kitty's icat command. -
backend: w3m
: uses thew3mimgdisplay
executable to draw directly onto the window. This has been tested inurxvt
andxterm
, but is known to produce weird results intmux
.If
w3mimgdisplay
is in a non-standard location, you can specify that usingpath
:backend: 'w3m' path: '/home/jasper/.local/bin/w3mimgdisplay'
Images using Evaluation
Rather than using the built-in image support, you can also use programs that write ASCII escape codes directly to the screen with code evaluation.
In order to do that, for example, we could configure kitten
code snippets
to evaluate using Kitty's command icat
. This uses the none
container
setting to ensure that the resulting output is not wrapped in a code block,
and the fragment
and replace
settings immediately replace the snippet.
---
patat:
eval:
kitten:
command: sed 's/^/kitten /' | bash
replace: true
fragment: false
container: none
...
See, for example:
```kitten
icat --align left dank-meme.jpg
```
Breadcrumbs
By default, patat
will print a breadcrumbs-style header, e.g.:
example.md > This is a title > This is a subtitle
This feature can be turned off by using:
patat:
breadcrumbs: false
Slide numbers
By default, patat
will display slide number in bottom-right corner
This feature can be turned off by using:
patat:
slideNumber: false
Evaluating code
patat
can evaluate code blocks and show the result. You can register an
evaluator by specifying this in the YAML metadata:
---
patat:
eval:
ruby:
command: irb --noecho --noverbose
fragment: true # Optional
replace: false # Optional
container: code # Optional
...
Here is an example of a code block that is evaluated:
```ruby
puts "Hi"
```
An arbitrary amount of evaluators can be specified, and whenever a a class attribute on a code block matches the evaluator, it will be used.
Note that executing arbitrary code is always dangerous, so double check the
code of presentations downloaded from the internet before running them if they
contain eval
settings.
Aside from the command, there are three more options:
fragment
: Introduce a pause (see fragments) in between showing the original code block and the output. Defaults totrue
.replace
: Remove the original code block and replace it with the output rather than appending the output in a new code block. Defaults tofalse
.container
: By default, the output is wrapped in a code block again with the original syntax highlighting. You can customize this behaviour by settingcontainer
to:code
: the default setting.none
: no formatting applied.inline
: no formatting applied and no trailing newline.
wrap
: this is a deprecated name forcontainer
, used in version 0.11 and earlier.
Setting fragment: false
and replace: true
offers a way to "filter" code
blocks, which can be used to render ASCII graphics.
---
patat:
eval:
figlet:
command: figlet
fragment: false
replace: true
...
```figlet
Fancy Font
```
This feature works by simply by:
- Spawn a process with the provided command
- Write the contents of the code block to the
stdin
of the process - Wait for the process to exit
- Render the
stdout
of the process
Speaker Notes
Version 0.9 and later support comments which can be used as speaker notes.
---
title: This is my presentation
author: Jane Doe
...
# Chapter 1
<!--
Note: I should not bore the audience with my thoughts on powerpoint but
just get straight to the point.
-->
Slide contents. Yay.
<!-- TODO: Finish the rest of the presentation. -->
You can also configure patat
to write the speaker notes for the current slide
to a file whenever the slide changes:
patat:
speakerNotes:
file: /tmp/notes.txt
Then, you can display these in a second terminal (presumably on a second monitor) by just displaying this file whenever it changes. entr is one way to do that:
echo /tmp/notes.txt | entr -s 'clear; cat /tmp/notes.txt'
Alternatively, just use a second patat
instance with --watch
enabled:
patat -w /tmp/notes.txt
Note that speaker notes should not start with <!--config:
, since then they
will be parsed as configuration blocks. They are allowed
to start with <!-- config:
; the lack of whitespace matters.
Transitions
Version 0.10 and later support transitions in between slides. A relatively fast terminal emulator (e.g. Alacritty, Kitty, iTerm2) is suggested when enabling this, to avoid too much flickering -- some flickering is unavoidable since we redraw the entire screen on each frame.
patat:
transition:
type: slideLeft
To set transitions on specific slides, use <!--config:
blocks, as detailed
in the configuration section. For example:
# Slide one
Slide one content.
# Slide two
<!--config:
transition:
type: slideLeft
duration: 2
-->
Slide two content.
Supported transitions type
s:
slideLeft
: slides the new slide in from right to left.dissolve
: changes characters over time.matrix
: loosely inspired by the 1999 science fiction movie.
All transitions currently take these arguments:
frameRate
: number of frames per second. Defaults to 24.duration
: duration of the animation in seconds. Defaults to 1.
Random transitions
You can set type
to random
to randomly pick a transition effect.
patat:
transition:
type: random
items:
- type: dissolve
duration: 3
- type: slideLeft
frameRate: 10
You can optionally set items
to a non-empty list of transition effects to
randomly sample from. If items
is not set, patat
will simply sample from
all transition effects using their respective default settings.
Trivia
"Patat" is the Flemish word for a simple potato. Dutch people also use it to refer to French Fries but I don't really do that -- in Belgium we just call fries "Frieten".
The idea of patat
is largely based upon MDP which is in turn based upon
VTMC. I wanted to write a clone using Pandoc because I ran into a markdown
parsing bug in MDP which I could not work around. A second reason to do a
Pandoc-based tool was that I would be able to use Literate Haskell as well.
Lastly, I also prefer not to install Node.js on my machine if I can avoid it.
Top Related Projects
The HTML Presentation Framework
Terminal based presentation tool
Persists tmux environment across system restarts.
Presentation Ninja 幻灯忍者 · 写轮眼
A simple, in-browser, markdown-driven slideshow tool.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot