https://github.com/0art0/lean-slides
A tool to auto-generate and render slides from Markdown comments in the Lean editor.
https://github.com/0art0/lean-slides
lean4 reveal-js
Last synced: 26 days ago
JSON representation
A tool to auto-generate and render slides from Markdown comments in the Lean editor.
- Host: GitHub
- URL: https://github.com/0art0/lean-slides
- Owner: 0art0
- License: gpl-3.0
- Created: 2023-07-30T12:49:43.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2026-03-10T23:07:36.000Z (4 months ago)
- Last Synced: 2026-05-30T04:06:00.119Z (27 days ago)
- Topics: lean4, reveal-js
- Language: Lean
- Homepage:
- Size: 95.7 KB
- Stars: 26
- Watchers: 3
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lean Slides
`Lean Slides` is a tool to
automatically generate `reveal.js` slides
from Markdown comments in the Lean editor.

See `Demo.lean` for more details.
# Dependencies
`Lean Slides` works by combining together several tools:
- [`reveal.js`](https://revealjs.com/) (no install required)
- [`pandoc`](https://pandoc.org/) (commit >= `7c6dbd3`)
- [`node.js`](https://nodejs.org/en)
- [`browser-sync`](https://browsersync.io/)
Note that `LeanSlides` may have issues with older versions of `pandoc`.
A manual intervention using
```lean
#set_pandoc_options "-V" "revealjs-url=\"https://unpkg.com/reveal.js@^4/\""
```
may fix the issues in such cases.
# Usage
To use `Lean Slides`, first install all the dependencies listed above.
`Lean Slides` can be added to an existing Lean repository
by inserting the following lines in the `lakefile.toml` file:
```toml
[[require]]
name = "lean-slides"
git = "https://github.com/0art0/lean-slides.git"
```
If the repository uses a `lakefile.lean` instead, try:
```lean
require «lean-slides» from git "https://github.com/0art0/lean-slides"@"master"
```
---
In any file that imports `LeanSlides`, type
```lean
#slides +draft Test /-!
-/
```
**Run `lake run lean-slides/serve-slides` from the command line
to start the HTTP server for the slides.**
Any slides that are not in draft mode should now be rendered.
The port used by `Lean Slides` can be modified through
an environment variable with the name `LEANSLIDES_PORT`.
# Features
`Lean Slides` turns comments written in the above format
into `reveal.js` slides which are rendered in the infoview
as a [`Widget`](https://github.com/EdAyers/ProofWidgets4).
The tool also features a code action to
go in and out of draft mode.
The generated `reveal.js` slides
render mathematics by default
using `KaTeX`.
## Custom styling
To enable custom CSS styling for the `reveal.js` presentation, insert a file named `style.css` in the `slides` folder (which is usually automatically generated in the home directory of your project by `Lean Slides`). A sample style sheet is shown below.
```css
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
text-transform: none;
}
.reveal code {
background-color: #5b5b5b;
padding: 0.1em 0.2em;
border-radius: 6px;
}
.reveal pre code {
background-color: #5b5b5b;
display: block;
padding: 1em;
border-radius: 6px;
overflow: auto;
}
```