presenterm Documentation
repository·master·Indexed 27 days ago
https://github.com/mfontanini/presentermA terminal-based slideshow presentation tool that uses Markdown as its source format. It supports interactive features including code execution, syntax highlighting, math formulas (LaTeX/Typst), and graphics such as images, animated GIFs, Mermaid, and D2 graphs. presenterm includes support for hot-reloading, customizable themes, and exporting presentations to PDF or HTML.
What's inside presenterm
- presenterm is a tool that allows you to create presentations using Markdown format and run them directly from your terminal. It supports advanced features like image and animated GIF rendering (on compatible terminals), customizable themes, code highlighting, and exporting presentations to PDF or HTML. It is designed for a fast development loop with support for hot-reloading.
Overview of presenterm features
masterpresenterm is a tool that allows you to create presentations using Markdown format and execute them directly from your terminal.
Key features include:
- Support for images and animated GIFs.
- Highly customizable themes.
- Code syntax highlighting.
- Ability to export presentations into PDF format.
Understand the Presenterm parsing and rendering flow
masterPresenterm follows a multi-stage pipeline to transform Markdown files into terminal output:
- Parsing: The Markdown file is parsed using the
comrakcrate into an Abstract Syntax Tree (AST). This AST is then flattened into a list ofMarkdownElements to simplify processing. - Building the Presentation: The flattened
MarkdownElements and a chosen theme are processed to create aPresentation. APresentationconsists of multiple slides, where each slide contains a sequence of render operations (primitives like rendering text, clearing the screen, or setting colors). - Rendering: The rendering engine iterates through the render operations of a slide and executes them using the
crosstermcrate. This stage handles terminal-specific tasks like word wrapping and margin management based on the current screen size.
- Parsing: The Markdown file is parsed using the
Set themes via CLI
masterYou can select a built-in theme by passing the--themeparameter when runningpresenterm.Export presentations to PDF
masterYou can convert presentations into PDF files using the
--export-pdfflag. This feature requires theweasyprinttool to be installed on your system.Prerequisites
Install
weasyprintfollowing their official installation instructions. If you use a separate virtual environment forweasyprint, ensure it is activated before runningpresenterm.Usage
Run
presentermwith the--export-pdfparameter followed by your markdown file. By default, the output is placed in the same directory as the source file with a.pdfextension. Use the--outputflag to specify a custom destination.Set themes in presentation front matter
masterYou can specify a theme directly within your presentation's markdown file using YAML front matter. There are four ways to configure this:
By name
Use a built-in theme name to override defaults or CLI options.
Light/Dark detection
Define different themes for light and dark terminal variants.
By path
Reference a custom theme file located on your filesystem using a YAML path.
Overrides
Partially or completely override specific theme properties (like
colors) without creating a new file. Overrides are reloaded whenever you save the presentation file.--- theme: # By name name: dark # Light/Dark detection light: light dark: dark # By path path: /home/me/Documents/epic-theme.yaml # Overrides override: default: colors: foreground: "beeeff" ---Include images in Typst snippets
masterWhen using the
#image()function inside atypstcode block, you must follow these rules:- Use absolute paths: e.g.,
#image("/image1.png"). - Path relativity: The absolute path is considered relative to the directory where your presentation file is located. You can reference files in the same directory or subdirectories of the presentation, but not parent directories.
- Use absolute paths: e.g.,
Configure Mermaid diagram width and scaling
masterYou can control the size of rendered Mermaid diagrams using two methods:
- Global Scaling: Adjust the
mermaid.scaleconfiguration parameter for a baseline size across all diagrams. - Per-snippet Width: Use the
+width:<number>%attribute within the code snippet to set a specific width relative to the window. This preserves the aspect ratio.
Best Practice: Set a reasonable
mermaid.scalefirst to ensure images are large enough, then use+widthfor fine-tuning to avoid blurry images caused by upscaling small images.sequenceDiagram Mark --> Bob: Hello! Bob --> Mark: Oh, hi mark!- Global Scaling: Adjust the
Configure slide transitions
masterYou can animate the movement between slides by configuring slide transitions in your settings. Refer to theslide-transitionssection in the configuration settings to enable and select an animation type.Define slide boundaries
masterBy default, slides are delimited by a specific HTML comment. To use thematic breaks (
---) instead, you must enable theend_slide_shorthandoption in your configuration.<!-- end_slide -->Configure alignment for elements
masterElements like code blocks, slide titles, intro slide components (title, subtitle, author), and tables support alignment.
Left/Right Alignment
Use
alignment: leftoralignment: rightwith amarginproperty. Margins can be defined as:- Fixed: A specific number of characters.
- Percent: A percentage of the total terminal columns (recommended for responsiveness).
Center Alignment
Use
alignment: centerwith two optional properties:minimum_size: The minimum width of the element (useful for code blocks to extend background color).minimum_margin: The minimum margin to keep on both sides of the text.
Configure Presenterm options
masterOptions are configuration parameters that can be set in two ways:
- In the global configuration file under the
optionskey. - In a specific presentation's front matter under the
optionskey. Using front matter allows you to customize the behavior of a single presentation without affecting others.
- In the global configuration file under the