Skip to main content

MkSlides - Slides with Markdown using the power of Reveal.js.

Project description

MkSlides

Use mkslides to easily turn markdown files into beautiful slides using the power of Reveal.js!

PyPI test-deploy.yml

MkSlides is a static site generator that's geared towards building slideshows. Slideshow source files are written in Markdown, and configured with a single YAML configuration file. The workflow and commands are heavily inspired by MkDocs and reveal-md.

Features

  • Build static HTML slideshow files from Markdown files.
    • Turn a single Markdown file into a HTML slideshow.
    • Turn a folder with Markdown files into a collection of HTML slideshows.
  • Publish your slideshow(s) anywhere that static files can be served.
    • Locally
    • On a webserver
    • Deploy through CI/CD with GitHub/GitLab (like this repo!)
  • Preview your site as you work, thanks to python-livereload.
  • Use custom favicons, CSS themes, templates, ... if desired.
  • Support for emojis :smile: :tada: :rocket: :sparkles: thanks to emoji
  • Depends heavily on integration/unit tests to prevent regressions.
  • And more!

Example

demo.webm

Youtube link in case you want to look at 2x speed.

Want more examples? An example repo with slides demonstrating all possibilities (Mermaid.js and PlantUML support, multicolumn slides, image resizing, ...) using Reveal.js with the HOGENT theme can be found at https://github.com/HoGentTIN/hogent-markdown-slides .

Installation

pip install mkslides

Create static site

E.g. when your Markdown files are located in the docs/ folder:

mkslides build docs/

E.g. when you have a single Markdown file called test.md:

mkslides build test.md

Live preview

mkslides serve docs/
mkslides serve test.md

Need help or want to know more?

Commands

mkslides build -h
mkslides serve -h

Configuration

Just create a mkslides.yml. All options are optional, you only have to add what you want to change to mkslides.yml.

Here's an example showcasing all possible options in the config file:

# Configuration for the generated index page
index:
    # Favicon of the generated index page: file path or public url to favicon
    # file
    favicon: ./example-index-favicon.ico

    # Jinja 2 template to generate index HTML: file path to Jinja2 file
    template: ./example.jinja

    # Theme of the generated index page: file path or public url to CSS file
    theme: example-index-theme.css

    # Title of the generated index page: string
    title: example-title

# Configuration for the slides
slides:
    # Charset of the slides: string
    # (see https://revealjs.com/markdown/#external-markdown)
    charset: utf-8

    # Favicon of the slides: file path or public url to favicon file
    favicon: ./example-slides-favicon.ico

    # Theme for syntax highlighting of code fragments on the slides: file path
    # to CSS file, public url to CSS file, or one of the highlight.js built-in
    # themes such as `monokai`, `obsidian`, `tokyo-night-dark`, `vs`, ...
    # (see https://highlightjs.org/examples)
    highlight_theme: example-slides-highlight-theme.css

    # Relative path to a python script containing a function
    # Callable[[str], str] named `preprocess`. For each Markdown file, the whole
    # file content is given to the function as a str. The returned string is
    # then further processed as the markdown to give to Reveal.js
    preprocess_script: tests/test_preprocessors/replace_ats.py

    # Separator to determine notes of the slide: regexp
    # (see https://revealjs.com/markdown/#external-markdown)
    separator_notes: "^Notes?:"

    # Separator to determine end current/begin new vertical slide: regexp
    # (see https://revealjs.com/markdown/#external-markdown)
    separator_vertical: ^\s*-v-\s*$

    # Separator to determine end current/begin new slide: regexp
    # (see https://revealjs.com/markdown/#external-markdown)
    separator: ^\s*---\s*$

    # Jinja 2 template to generate index HTML: file path to Jinja2 file
    template: ./example.jinja

    # Theme of the slides: file path to CSS file, public url to CSS file, or one
    # of the reveal.js themes such as `black`, `white`, `league`, `solarized`,
    # `dracula`, ... (see https://revealjs.com/themes/)
    theme: example-slides-theme.css

# Options to be passed to reveal.js: options in yaml format, they will be
# translated to JSON automatically (see https://revealjs.com/config/)
revealjs:
    height: 1080
    width: 1920
    transition: fade

    example_plugin:
        example_plugin_option_A: true
        example_plugin_option_B: qwerty

# Plugins or additional CSS/JavaScript files for the slides. These are given as
# a list.
plugins:
    # Name of the plugin (optional, see plugin README): plugin id string
    # (see https://revealjs.com/creating-plugins/#registering-a-plugin)
    - name: RevealExamplePlugin
      # List of CSS files of the plugin (optional, see plugin README):
      # public url to CSS file per entry
      extra_css:
          - https://cdn.jsdelivr.net/npm/reveal.js-example-pluging/example.min.css
      # List of JavaScript files of the plugin (optional, see plugin README):
      # public url to JavaScript file per entry
      extra_javascript:
          - https://cdn.jsdelivr.net/npm/reveal.js-example-pluging/example.min.js
    - name: RevealMermaid
      extra_javascript:
          - https://cdn.jsdelivr.net/npm/reveal.js-mermaid-plugin/plugin/mermaid/mermaid.min.js
    - extra_javascript:
          - https://cdn.jsdelivr.net/npm/reveal-plantuml/dist/reveal-plantuml.min.js

Default config (also used if no config file is present):

index:
    title: Index
    template: assets/templates/index.html.jinja # Comes with the pip package
slides:
    theme: black
    highlight_theme: monokai
    template: assets/templates/slideshow.html.jinja # Comes with the pip package
revealjs:
    history: true
    slideNumber: c/t

It is also possible to override slides, revealjs, and plugins options on a per Markdown file base using it's frontmatter:

---
title: frontmatter title
slides:
    theme: solarized
    highlight_theme: vs
    separator: <!--s-->
revealjs:
    height: 1080
    width: 1920
    transition: zoom
---

# Slides with frontmatter

<!--s-->

## Lorem ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

<!--s-->

Notes:

  • title here is a frontmatter-only available option to set the title of this slideshow in the generated index page. This option is not available in mkslides.yml.
  • The precedence is frontmatter > mkslides.yml > defaults.

Full help

Usage: mkslides [OPTIONS] COMMAND [ARGS]...

  MkSlides - Slides with Markdown using the power of Reveal.js.

Options:
  -V, --version  Show the version and exit.
  -v, --verbose  Enable verbose output
  -h, --help     Show this message and exit.

Commands:
  build  Build the MkDocs documentation.
  serve  Run the builtin development server.
Usage: mkslides build [OPTIONS] FILENAME|PATH

  Build the MkDocs documentation.

  FILENAME|PATH is the path to the Markdown file, or the directory containing
  Markdown files.

Options:
  -f, --config-file FILENAME  Provide a specific MkSlides-Reveal config file.
  -d, --site-dir PATH         The directory to output the result of the slides
                              build. All files are removed from the site dir
                              before building.
  -s, --strict                Fail if a relative link cannot be resolved,
                              otherwise just print a warning.
  -h, --help                  Show this message and exit.
Usage: mkslides serve [OPTIONS] FILENAME|PATH

  Run the builtin development server.

  FILENAME|PATH is the path to the Markdown file, or the directory containing
  Markdown files.

Options:
  -f, --config-file FILENAME  Provide a specific MkSlides-Reveal config file.
  -s, --strict                Fail if a relative link cannot be resolved,
                              otherwise just print a warning.
  -a, --dev-addr <IP:PORT>    IP address and port to serve slides locally.
  -o, --open                  Open the website in a Web browser after the
                              initial build finishes.
  -h, --help                  Show this message and exit.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkslides-1.0.10.tar.gz (3.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkslides-1.0.10-py3-none-any.whl (4.5 MB view details)

Uploaded Python 3

File details

Details for the file mkslides-1.0.10.tar.gz.

File metadata

  • Download URL: mkslides-1.0.10.tar.gz
  • Upload date:
  • Size: 3.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.9 Linux/6.15.4

File hashes

Hashes for mkslides-1.0.10.tar.gz
Algorithm Hash digest
SHA256 d7797e6483d2615d512911d9d527178081a39ee361c1098aaad7c1d0944f4cbc
MD5 4b448c7301a52e76ef773b0979026587
BLAKE2b-256 7636f0b53e57d9b489aff4f54d3008558754628ed0c0d5d11167c4eac81343dc

See more details on using hashes here.

File details

Details for the file mkslides-1.0.10-py3-none-any.whl.

File metadata

  • Download URL: mkslides-1.0.10-py3-none-any.whl
  • Upload date:
  • Size: 4.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.9 Linux/6.15.4

File hashes

Hashes for mkslides-1.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 6b291a0b7e6681897ceef0d202c2ddffcb1acf2bb35387ef87d28f0f6eebc120
MD5 ff34b1eb9cc5d86635aca636bb3172fc
BLAKE2b-256 a3021a8254d6ab6a69acdabb62266ce3388e6c72b3c2a54284939a38ec8b05cc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page