Lightweight markup language-based html5 slideshow generator. Forked from Landslide.
Lightweight markup language-based html5 slideshow generator. Forked from landslide.
Landslide generates a slideshow using from markdown, ReST, or textile. It builds off of Google’s html5slides template.
The following markdown produces this slideshow.
python and the following modules:
- pygments for code blocks syntax coloration
- watchdog for watching/auto-regeneration with the -w flag
- PrinceXML for PDF export
Install the latest stable version of Landslide with a python package manager like pip:
$ pip install landslide
If you want to stay on the edge:
$ git clone https://github.com/adamzap/landslide.git $ cd landslide $ python setup.py build $ sudo python setup.py install
- Your Markdown source files must be suffixed by .md, .markdn, .mdwn, .mdown or .markdown
- To create a title slide, render a single h1 element (eg. # My Title)
- Separate your slides with a horizontal rule (--- in markdown) except at the end of md files
- Your other slides should have a heading that renders to an h1 element
- To highlight blocks of code, put !lang where lang is the pygment supported language identifier as the first indented line
- Your ReST source files must be suffixed by .rst or .rest (``.txt`` is not supported)
- Use headings for slide titles
- Separate your slides using an horizontal rule (---- in RST) except at the end of RST files
- Separate your slides using ---, just like in markdown
- Run landslide slides.md or landslide slides.rst
- Enjoy your newly generated presentation.html
Or get it as a PDF document if PrinceXML is installed and available on your system:
$ darkslide README.md -d readme.pdf $ open readme.pdf
- Press h to toggle display of help
- Press left arrow and right arrow to navigate
- Press t to toggle a table of contents for your presentation. Slide titles are links
- Press ESC to display the presentation overview (Exposé)
- Press n to toggle slide number visibility
- Press b to toggle screen blanking
- Press c to toggle current slide context (previous and next slides)
- Press e to make slides filling the whole available space within the document body
- Press S to toggle display of link to the source file for each slide
- Press ‘2’ to toggle notes in your slides (specify with the .notes macro)
- Press ‘3’ to toggle pseudo-3D display (experimental)
- Browser zooming is supported
Several options are available using the command line:
Landslide allows to configure your presentation using a cfg configuration file, therefore easing the aggregation of source directories and the reuse of them across presentations. Landslide configuration files use the cfg syntax. If you know ini files, you get the picture. Below is a sample configuration file:
Don’t forget to declare the [landslide] section. All configuration files must end in the .cfg extension.
To generate the presentation as configured, just run:
$ cd /path/to/my/presentation/sources $ darkslide config.cfg
You can use macros to enhance your presentation:
Add notes to your slides using the .notes: keyword, eg.:
# My Slide Title .notes: These are my notes, hidden by default My visible content goes here
You can toggle display of notes by pressing the 2 key.
Some other macros are also available by default: .fx: foo bar will add the foo and bar classes to the corresponding slide <div> element, easing styling of your presentation using CSS.
Add a QR Code to your presentation by using the .qr keyword:
Add footnote to the current and all the following presentations
.footnote: Slides available at https://blog.ionelmc.ro/presentations/
You can also add presenter notes to each slide by following the slide content with a heading entitled “Presenter Notes”. Press the ‘p’ key to open the presenter view.
Macros are used to transform the HTML contents of your slide.
You can register your own macros by creating landslide.macro.Macro derived classes, implementing a process(content, source=None) method and returning a tuple containing the modified contents and some css classes you may be wanting to add to your slide <div> element. For example:
!python import landslide class MyMacro(landslide.Macro): def process(self, content, source=None): return content + '<p>plop</p>', ['plopped_slide'] g = landslide.generator.Generator(source='toto.md') g.register_macro(MyMacro) print g.render()
This will render any slide as below:
!html <div class="slide plopped_slide"> <header><h2>foo</h2></header> <section> <p>my slide contents</p> <p>plop</p> </section> </div>
Setting Custom Destination File
$ darkslide slides.md -d ~/MyPresentations/presentation.html
Working with Directories
$ darkslide slides/
Working with Direct Output
$ darkslide slides.md -o | tidy
Using an Alternate Landslide Theme
$ darkslide slides.md -t mytheme $ darkslide slides.md -t /path/to/theme/dir
Embedding Base-64-Encoded Images
$ darkslide slides.md -i
Exporting to PDF
$ darkslide slides.md -d presentation.pdf
Enabling Markdown Extensions
See documentation on available Markdown extensions here:
$ darkslide slides.md -x abbr
A Darkslide theme is a directory following this simple structure:
mytheme/ |-- base.html |-- css | |-- print.css | `-- screen.css `-- js `-- slides.js
If a theme does not provide HTML and JS files, those from the default theme will be used. CSS is not optional.
Last, you can also copy the whole theme directory to your presentation one by passing the --copy-theme option to the darkslide command:
$ darkslide slides.md -t /path/to/some/theme --copy-theme
If you don’t want to bother making your own theme, you can include your own user css and js files to the generated presentation.
This feature is only available if you use a Darkslide configuration file, by setting the css and/or js flags:
[darkslide] ; the old [landslide] is still supported theme = /path/to/my/beautiful/theme source = slides.mdown css = custom.css js = jquery.js powerpoint.js
These will link the custom.css stylesheet and both the jquery.js and powerpoint.js files within the <head> section of the presentation html file.
NOTE: Paths to the css and js files must be relative to the directory you’re running the darkslide command from.
Publishing your Presentation Online
If you intend to publish your HTML presentation online, you’ll have to use the --relative option, as well as the --copy-theme one to have all asset links relative to the root of your presentation;
$ darkslide slides.md --relative --copy-theme
That way, you’ll just have to host the whole presentation directory to a webserver. Of course, no Python nor PHP nor anything else than a HTTP webserver (like Apache) is required to host a Darkslide presentation.
The base.html must be a Jinja2 template file where you can harness the following template variables:
- css: the stylesheet contents, available via two keys, print and screen, both having:
- a path_url key storing the url to the asset file path
- a contents key storing the asset contents
- a path_url key storing the url to the asset file path
- a contents key storing the asset contents
- slides: the slides list, each one having these properties:
- header: the slide title
- content: the slide contents
- number: the slide number
- embed: is the current document a standalone one?
- num_slides: the number of slides in current presentation
- toc: the Table of Contents, listing sections of the document. Each section has these properties available:
- title: the section title
- number: the slide number of the section
- sub: subsections, if any
- To change HTML5 presentation styles, tweak the css/screen.css stylesheet bundled with the theme you are using
- For PDF, modify the css/print.css
Darkslide v4.0.1 (2017-10-19)
- Fixed print css a bit.
- Fixed missing scrolling to current when changing slides while in overview mode.
Darkslide v4.0.0 (2017-10-17)
- Dropped MathJax support. Something less to maintain (also, didn’t work as expected with --embed). User that need this should just use the user_js option. Or a custom theme.
- Changed themes to use a space-adjusted Alegreya Sans as a fallback.
Darkslide v3.2.0 (2017-10-17)
- Changed themes to use Rosario as a fallback. For better or worse it’s smaller and has same width as Candara.
Darkslide v3.1.0 (2017-10-17)
- Changed themes to embed a Candara fallback webfont (Alegreya Sans). It’s slightly narrower but looks more similar than the other alternatives better matching Candara’s width (Acme, Galdeano). It even has ligatures.
Darkslide v3.0.1 (2017-10-15)
- Fixed slightly broken slide class changing.
- Made expose mode scroll to current slide.
- Running presenter mode with no target won’t break anymore if target window is gone.
- Fixed display of presenter notes.
Darkslide v3.0.0 (2017-10-05)
- Removed “expanded mode”. It was too buggy and doesn’t really have a purpose.
- Changed “show context” to be “show next slide” (so two slides at a time). This is way more useful than showing little bits of next and prev slides.
- Fixed --direct on Python 3.
- Fixed glitches when TOC/Help are open.
- Made possible to switch slides when TOC/Help/Overview are open.
Darkslide v2.3.3 (2016-05-15)
- Fixed height of QR svg elements.
Darkslide v2.3.2 (2016-04-12)
- Fixed underline occlusion shadows in the footer (for links).
- Fixed missing presenter_notes class not being set when notes mode was on.
Darkslide v2.3.1 (2016-02-08)
- MathJax is loaded on HTTPS.
Darkslide v2.3.0 (2016-02-07)
- The Darkslide version is shown in the help sidebar.
Darkslide v2.2.1 (2015-10-06)
- Fixed config file parsing for math_output.
Darkslide v2.2.0 (2015-10-06)
- Now macro failures abort rendering. Previously they would just log a message that you’d probably woulnd’t notice.
- Fixed broken handling where you have css/js in the cfg file.
- Allowed setting the math_output option in the cfg file.
- Fixed encoding issues in the QR macro.
- Added back the old theme with completely black background (as “void”).
- Tweak the faux underlines to look better.
Darkslide v2.1.0 (2015-10-05)
- Added demo links.
- Fixed options handling. Options from command line now will actually work if a cfg file is used.
- Corrected relative paths handling:
- paths in sources are now relative to the cfg file (previously they were relative to whatever was cwd).
- relative option now correctly works when destination file is not in cwd.
- Fixed layout of slides with many headering (no more paddings for headings, all root elements are spread out evenly anyway).
- Fixed bad styling of ToC (and probably other things in the sidebar).
- Fixed ToC links (contributed by Cyrille Pontvieux).
Darkslide v2.0.4 (2015-09-09)
- Improved handling for filenames that have non-ascii characters in them.
Darkslide v2.0.3 (2015-09-08)
- Fixed handling for filenames that have non-ascii characters in them.
Darkslide v2.0.2 (2015-07-20)
- Added color classes in the abyss theme.
- Fixed link underlines in the presenter notes.
Darkslide v2.0.1 (2015-07-19)
- Don’t use Monaco in the base.css - it’s way bigger than Consolas and the other fonts. And Consolas is nice enough.
Darkslide v2.0.0 (2015-07-17)
- Fix display of RST image target links.
- Add cmd line option to print version.
- Rewrote the default theme (solarized colors)
- Overhauled the abyss theme, improved the coloring.
- Removed all the other themes (they are ugly and broken anyway) (backwards incompatible).
- Fixes for print css.
- Added support for two new css files: base.css and theme.css. This makes reusing styles acros themes and kinds of display (print/screen) more easy.
- Expanded mode is now activated by default.
- Changed macros to use compiled regexes.
- Added a footnote macro.
- Changed QR macro to use qrcode library. Now it’s rendered to SVG. The size is removed (backwards incompatible).
Darkslide v1.2.2 (2015-05-22)
- Fix the blank page issue when generating pdfs (via Chrome’s pdf printer).
Darkslide v1.2.1 (2015-05-21)
- Couple minor improvements to Abyss theme.
Darkslide v1.2.0 (2015-05-19)
- Modifier keys flag was not cleared propertly (kb shortcuts were not working anymore after alt-tab etc); now it’s cleared on visibility changes and focus loss.
- Changed expanded mode to automatically hide the context.
- Fixed window resize flickering (for every resize event the expaded flag was toggled).
- Disabled context hiding in presenter view.
- Other small styling improvements.
- Added “abyss” theme.
- Identify each slide by a numbered class (#171) (dkg)
- Fix theme image embedding regex to grab all images (#170)
- Fix blockquote font size for rst (#161)
- Fix display of RST image target links (#87)
- Fix relative path generation (#147)
- Add command line option for print version (#135)
- Add use of ‘—’ as a slide separator to textile files (#163)
- README improvements (#88 and #101)
- Improve image path regex and replacement (#177)
- Add support for Python 3
- Allow support for copy_theme argument in CFG files (#139) (syscomet)
- Improve MathJax rendering for Markdown files
- Support math output (#144) (davidedelvento)
- Allow presenter notes in slides with no heading in RST files (#141) (regebro)
- And more…
- Don’t accidentally require watchdog (#134)
- Add CHANGELOG
- Add “ribbon” theme from “shower” presentation tool (#129) (durden)
- Add -w flag for watching/auto-regenerating slideshow (#71, #120) (jondkoon)
- Supress ReST rendering errors
- CSS pre enhancements (#91) (roktas)
- Add an example using presenter notes (#106) (netantho)
- Run macros on headers also, to embed images (#74) (godfat)
- Allow PHP code snippets to not require <?php (#127) (akrabat)
- Allow for line numbers and emphasis with reStructuredText (#97) (copelco)
- Add an option to strip presenter notes from output (#107) (aaugustin)
- Firefox offset bug on next slide (#73)
- Fix base64 encoding issue (#109) (ackdesha)
- Fix to embed images defined in CSS (#126) (akrabat)
- Minor documentation fixes (#119, #131) (durden, spin6lock)
- Use configured encoding when reading all embedded files (#125) (iguananaut)
- Allow pygments lexer names that include special characters (#123) (shreyankg)
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, Size & Hash SHA256 Hash Help||File Type||Python Version||Upload Date|
(1.5 MB) Copy SHA256 Hash SHA256
|Wheel||py2.py3||Oct 18, 2017|
(1.5 MB) Copy SHA256 Hash SHA256
|Source||None||Oct 18, 2017|