Giter Club home page Giter Club logo

markdeep-slides's Introduction

markdeep-slides

Build presentation slides with Markdeep and present them right in your browser.

  • Two modes:
    • Initially, you're in draft mode – with inline presenter notes, useful as a preview when building slides.
    • You can switch into presentation mode (shown to the right) – with your slides shown fullscreen and your presenter notes in a separate window.
    • You can also generate a PDF version of your slides by printing them to a PDF (use Chrome for this; more below).
  • Keyboard shortcuts for all relevant functions (see below).
  • Supports all features Markdeep has to offer – diagrams, math, inline videos, citations, admonitions, and all the standard Markdown stuff.
  • 3 built-in themes – but if you don't like any of them or want to adjust stuff: Style your slides with CSS! LaTeX and Beamer are great, but things can get tricky if you really want to make them your own.
  • The full power of CSS animations and JavaScript is at your fingertips – use it wisely.
  • Compatible with those little presenter gadgets.

💻 Try out a demo presentation and take a look at its Markdeep source code.

Also, check out markdeep-thesis and markdeep-diagram-drafting-board!

Getting started

Setup

This repository contains copies of all dependencies (Markdeep, MathJax, and the webfonts used by the built-in themes) by design – it'll work offline (unless you include YouTube videos or something in your slides). You don't want to rely on wifi being available when and where you'll present – that's just asking for trouble.

📦 Clone this repository or download a ZIP.

Then simply...

  1. navigate to demo.md.html,
  2. open it in your text editor and browser of choice, and
  3. start building your slides. Easy!

Shortcuts

Use the following keyboard shortcuts to steer your presentation. Press...

  • Space, , or PgDn to go to the next slide,
  • , or PgUp to go to the previous slide,
  • F, F5 or Esc to toggle fullscreen/presentation mode,
  • . to turn the screen black (and back again),
  • n to toggle a window with your presenter notes,
  • t to start or dismiss a timer counting up from zero seconds (shown in the presenter notes window), and
  • a slide number, e.g. 1 7, followed by Enter, to jump directly to that slide.

Options

At the bottom of demo.md.html, right before a bunch of essential JavaScript files are loaded, you'll find a set of options. Their default values (each of which is automatically applied if you omit the corresponding option) are:

<script>
markdeepSlidesOptions = {
    aspectRatio: 16 / 9,      // aspect ratio of your slides
    theme: 'simple',          // theme – "simple", "deepsea", "serif" or path of a stylesheet
    fontSize: 28,             // base font size, relative to slide display size
    diagramZoom: 1.0,         // markdeep diagram scaling factor
    totalSlideNumber: false,  // show total number of slides next to slide number?
    progressBar: true,        // show a presentation progress bar on each slide?
    breakOnHeadings: false,   // start a new slide not only on encountering "---", but also level 1 and 2 headings?
    slideChangeHook: (oldSlide, newSlide) => {},  // function executed whenever the current slide changes, receives old and new slide number
    modeChangeHook: (newMode) => {}               // function executed whenever the mode changes, receives new mode, e.g. "draft" or "presentation"
};
</script>

Modify them to your liking, but don't decrease the font size too much (nobody wants to read novel-length slides). Additionally, you can tweak some aspects of each theme by overriding CSS variables – take a look at the relevant file in markdeep-slides/themes/.

Exporting to PDF

It's best to use Chrome for generating a PDF version of your slides – it respects the page size that's automatically specified in CSS based on your chosen aspect ratio (unlike all other browsers). In Chrome's print window, set "Margins" to "None" and make sure to keep the "Background graphics" option enabled.

In my experience, once you've dialled in this print configuration, you can run Chrome headlessly for future exports (you may need to boost the --virtual-time-budget depending on the complexity of your slides):

chrome --headless --disable-gpu --print-to-pdf=demo.md.html.pdf --no-margins --virtual-time-budget=5000 demo.md.html

Examples

Here's a list of presentations that folks have built using this tool:

  • Christian Duta, Torsten Grust: "Functional-Style UDFs with a Capital 'F'". Presented at SIGMOD 2020. 🎥 Video
  • Joel Falcou: "An array of problems. An array of solutions". 🎥 Video, 🗂 Slides
  • Yuri Valentini: "Test basati su proprietà con rapidcheck". 🎥 Video, 🗂 Slides
  • Alexander Tchitchigin: Various presentations. 🗂 Slides
  • Benson Muite: "Speeding up Computer Graphics". 🗂 Slides
  • ...and yours?

Contributing

Got an idea on how to improve something? Ran into unexpected behavior? Found a bug? (Maybe even fixed that bug?)

Please file an issue or send a pull request! I'll be glad to take a look at it.

I'd love to hear from you (or take a peek at your slides) if you've used this tool in practice.


Notes

  • Tested in recent versions of Chrome, Firefox and Safari. I don't have access to Edge/IE, so you're on your own there (although I suspect that folks interested in building their slides with Markdeep aren't using these browsers anyway). Not really made for mobile use, although scrolling through slides in draft mode works fine.
  • The included variant of MathJax has been heavily stripped down and only allows SVG as the output format. This was done to keep the size to a minimum and because SVG output looks best (other formats may be more accessible, but that doesn't matter in a presentation context).
  • To display the current date on your title slide (or anywhere), simply write <span class="current-date"></span>markdeep-slides takes care of the rest.
  • CSS animations play back on page load in draft mode, but on slide change in presentation mode.
  • If your presenter gadget doesn't work here, please go to https://keycode.info and record 1. which keycodes each button sends, 2. what happened, 3. what you expected to happen and file an issue accordingly.

Making your own theme

  • If you're making your own themes, make sure that all font-sizes, margins, paddings, widths, heights and other sizes are defined in terms of rem, em, or %. This enables your elements to scale properly depending on screen size. So don't use px, pt, or mm.
  • Also don't use vw and vh as size units – depending on the aspect ratio of your display and your slides, your slides will be letterboxed, so 100vh might be larger than the width of your slides (the same goes for height). The actual slide width and height can be read from the CSS variables var(--slide-width) and var(--slide-height), respectively.
  • Use CSS variables to keep your theme configurable (take a look at the existing themes to see some examples).
  • If you want your slides to have a non-white background, set it on the body selector as opposed to the .slide selector. This prevents small gaps caused by rounding errors from showing up in exported PDFs.
  • Keep in mind that the presenter notes will inherit your theme's styles. You can override specific styles by targeting the .presenter-notes class.
  • Download any webfonts to your computer. Again, you don't want to rely on wifi being available when and where you'll present. I recommend using this tool to download webfonts from Google Fonts.

Known issues

If you know of an elegant way of fixing these, I'd very much appreciate a heads up.

  • When resizing the window in Safari in draft mode, the font size is not scaled accordingly. No idea why – it's defined in terms of vw units in CSS, so it should scale as the viewport width changes. It does in all other browsers, anyway.
  • When leaving fullscreen mode in Firefox using Esc, presentation mode often persists. No idea why – leaving it by pressing f fires the same event, so the same stuff should happen.
  • After refreshing while in fullscreen mode in Safari, the only way to exit fullscreen mode is clicking the green button – and even after that, presentation mode persists because the webkitfullscreenchange event does not fire in this situation. (Other browsers exit fullscreen mode upon refresh, making this a non-issue there.)
  • Firefox, when applying an invert() filter to two selectors referring to elements that may contain each other, applies the filter to both elements separately, i.e. the filter cancels itself out. Other browsers do the "right" thing. This affects code snippets with line numbers when using the deepsea theme.
  • When printing to PDF in Chrome, you need to scroll all the way to the top before opening the print dialog – if you don't, some background colors might be missing. When rendering the page in print mode using the developer tools (or in any other circumstance), this issue unsurprisingly does not occur.

License

You may use this repository's contents under the terms of the BSD 2-Clause "Simplified" License, see LICENSE.

However, the subdirectory markdeep-slides/lib/ contains third-party software with its own licenses:

  • Morgan McGuire's Markdeep is also licensed under the BSD 2-Clause "Simplified" License, see here.
  • Markdeep includes Ivan Sagalaev's highlight.js with its BSD 3-Clause License, see here.
  • MathJax is licensed under the Apache License 2.0, see here.
  • All included webfonts (IBM Plex Mono, Iosevka, Libre Franklin, Source Sans Pro, Source Serif Pro, Vollkorn) are licensed under the SIL Open Font License, see here.

markdeep-slides's People

Contributors

bkmgit avatar doersino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

markdeep-slides's Issues

Improve default theme, add one or more other themes and improve the way themes are set

Some margins and paddings in slides-theme-simple.css need tightening up, and some default Markdeep elements should be restyled.

Other theme ideas: A minimalist serif theme and a dark blue/gray theme, similar to Sublime's Mariana color scheme.

Theme CSS files should perhaps be named markdeep-slides-theme-....css and documented/previewed in the demo slides and README.md.

Improve styling of presenter notes in pop-out window

The presenter notes are looking a bit drab right now.

A related issue is that the presenter notes shown inline in draft mode inherit their styles from the slides, while the presenter notes window uses standard browser styles (which, come to think of it, will mess with some Markdeep features if the user chooses to be cute about their presenter notes).

Clearly, both of these points should be addressed, probably via style inheritance from the main window?

Ship "batteries included" releases with bundled Markdeep and MathJax

Shipping versioned "batteries included" releases with bundled Markdeep and MathJax (and perhaps some webfonts) would circumvent potential "I'm about to give my talk and my slides are utterly broken because there's no wifi" issues.

Downside: Extra work. But worth it, also to have well-defined versions (with specific upgrade instructions, if needed).

Make videos with the autoplay attribute start playing only when they're shown

Right now, <video src="..." autoplay> causes the video to start playing on page load, which is not what you want in a presentation. Ideal behaviour would be...

  • ...in draft mode, don't autoplay ever.
  • ...in presentation mode, start playing once the slide containing the video is flipped to and stop once the next slide is requested.

I think this could be accomplished by translating the autoplay attribute into a data-autoplay attribute in a preprocessing step and invert this translation when the slide is active (and again once it becomes inactive).

Restore scroll position more accurately when refreshing whilst in draft mode

Right now, whichever slide is completely visible and closest to the viewport's top edge is noted in the URL hash and thus aligned to the viewport's top edge on refresh.

This keeps things simple and somewhat transparent to the user, but perhaps it would make sense to maintain a more accurate position (or offset from the top of the slide specified in the URL hash) in local storage or something?

In presentation mode, this more accurate position should of course be ignored.

Parsing of code in slides, HTML entities

There can be errors when parsing HTML entities in slides, in particular <, > and & may be parsed incorrectly if not replaced by &lt;, &gt; and &amp; or &#60;, &#62; and &#38;. As an example

for(int i=0;i<10;i++){
  printf("%i\n",i);
}

will render incorrectly in slides, but

for(int i=0;i&lt;10;i++){
  printf("%i\n",i);
}

will render correctly.

fixed width font custom iosevka

you are using my favorite font family for fixed width font contexts such as code snippets. Great!
I have spent a lot of time tweaking the iosevka font to have well-distinguishable l1ij, O0, {([ and a few others. I have attached the result with this issue ticket. Feel free to review it and, if you like, to replace the current default iosevka with my custom edition. I grant BSD style totally free use of these fonts with no requirement to mention where they are from. Just use it and be happy :-)

iosevka-Ingmar-narrow.zip

Add way of filling an entire slide with an image or video

Being able to fill an entire slide with an image or video (perhaps with any aspect ratio mismatch-created gaps filled with black) would be neat.

This would be similar to how Deckset does slide-filling content and could be achieved by adding an attribute via Markdeep...

![](image.jpg full)

...and matching on this via CSS, something like this:

center img[full],
center video[full],
center iframe[full] {
    margin-top: -1rem;  /* counteract center top margin */
    margin-left: -2rem;  /* counteract side margin */
}
center img[full], ... {
    max-height: var(--slide-height);
    max-width: var(--slide-width);
}

I likely won't tackle this anytime soon, though.

"Relativize" some widths, heights, margins etc. from the standard Markdeep stylesheet

The stylesheet that's built into Markdeep comes with some sizes defined in terms of px, which won't be consistent for arbitrarily sized slides (unless I switch to zooming slides from the default width of 640px (instead of increasing the root's font size and defining everything in terms of that), which would actually be worth exploring, but might open a whole other can or worms).

So it would make sense to "relativize" these sizes in another stylesheet that's applied before markdeep-slides.css to be defined in terms of rem (or em, where appropriate).

An issue, then, will be future updates and feature additions to Markdeep – I'd have to make sure to keep this "relativization" up to date.

Show presenter notes inline in draft mode

Right now, the presenter notes window needs to be opened to review the notes as the user is building their presentation.

It would be neat if presenter notes were displayed below each slide in draft mode, on a black blackground (with some nice gradient?) to mirror the styling of the presenter notes window. This would, however, require some changes to the markup, from currently

<div class="slide" id="...">
    <div class="slide-number">...</div>
    <div class="presenter-notes">...</div>
    ...
</div>

to then

<div class="slide" id="...">
    <div class="slide-number">...</div>
    <div class="content">
            ...
    </div>
    <div class="presenter-notes">...</div>
</div>

which would also allow for a more elegant approach to letterboxing (because of the additional element being available for styling). Worth thinking about.

Add a progress meter/bar

Add a progress meter/bar based on currentSlideNum and slideCount (the latter of which would have to be precomputed before <hr> replacement). It would make sense to add a <div class="progressbar" data-progress="...%"></div> (or just with ...style="width: ...%;"...) element to each slide, hidden by default and to be positioned and styled by each theme.

Allow pausing the timer

As of now, pressing t toggles the timer shown in the presenter notes window. That is,

  • if the timer is inactive, it is started and shown, and
  • if the timer is active, it is hidden and reset to 0.

I can imagine situations where it would be beneficial to pause the timer. The following interaction would make sense to me: If the user presses t,

  • if the timer is inactive, it is started and shown (nothing new here), and
  • if the timer is active, it is paused (this could be visually further emphasized by making it blink).
  • To reset the timer, the user would have to press tt (i.e. twice in quick succession, perhaps within half a second), which would hide and reset the timer.

Since pausing the timer is implementation-wise not completely trivial, I might not address this unless someone wants me to (leave a comment!).

Issues with printing

After the most recent commit, the slides are too zoomed in when trying to print in Chrome. Have you observed this?

Improve layout of calendars and schedule lists in sample themes

Calendars and schedule lists are difficult to adapt to slides:

  • Given a schedule list in Markdeep source code, Markdeep generates a calendar and, below that, a schedule list.
  • There's no way both of them would fit on a single slide for even moderately busy schedules.
  • They're both tables, with some lengths defined inline in terms of pixels – these need conversion to rem.

I likely won't tackle this anytime soon since I've yet to use a schedule list myself, but it's certainly worth taking at stab at.

Bring README.md up to snuff

Decide how much and which content to share between the demo slides and README.md. Add a note on why the license was chosen (because Markdeep was released under the same license).

Fix Markdeep diagrams not being scaled when resizing the window or going fullscreen

Markdeep renders diagrams to SVG at a fixed pixel size. When resizing the window, the diagram isn't zoomed accordingly – but this will be required for presentation mode and exporting slides to PDF.

I've got the following procedure in mind:

  • Assume all diagrams are rendered with respect to a slide width of 640px (or something like it; this is the default setting for PDF output).

  • After diagrams have been rendered, grab their width and height values, convert them to rem (based on a 640px slide width), and store them in a data attribute or something.

  • On

    • load,
    • resize, and
    • going fullscreen,

    re-convert the stored width and height back to pixels, compare them to the original width and height values, compute the required CSS zoom percentage and apply that.

This seems massively inelegant, complicated, error-prone and like too much work. Hmm.

Allow jumping to a certain slide by entering its number and pressing enter

For example, 1 2 Enter should book the user on a direct (and immediate) flight to slide 12, without any layovers on in-between slides.

Ideal for jumping to a pertinent slide during a post-talk Q&A.

(Most native presentation applications support this, I think. I've always missed the simplicity of this features in PDF readers.)

directory structure for multiple slide sets

I'm just starting out with markdeep-slides, but am already very excited!
I'd like to have a bunch of slide sets, one for each chapter in my 'book'.
They all have accompanying files, so each chapter should be its own subdirectory.
With the current setup in the repo that means I need to copy the markdeep-slides folder into each of the chapter folders. That's a pain to maintain if there are changes to the folder and is a lot of wasted space. Instead, I'd like to move the markdeep-slides folder one up in the directory structure so it becomes a sibling of Chapter1, Chapter2, Chapter3, etc.
It seemed pretty straightforward. I simply edited the final section to prepend the paths with '../'. And it mostly works, but somehow the fonts are not the correct ones and it's not obvious why. So this issue is to get assistance in fixing the fonts. Here is my final demo.md.html section:

<!-- Markdeep slides stuff -->
<script>
    markdeepSlidesOptions = {
        aspectRatio: 16 / 9,
        theme: 'simple',
        fontSize: 28,
        diagramZoom: 1.0,
        totalSlideNumber: false,
        progressBar: true,
        breakOnHeadings: false,
        slideChangeHook: (oldSlide, newSlide) => {},
        modeChangeHook: (newMode) => {}
    };
</script>
<link rel="stylesheet" href="../markdeep-slides/lib/markdeep-relative-sizes/1.11/relativize.css">
<link rel="stylesheet" href="../markdeep-slides/markdeep-slides.css">
<script src="../markdeep-slides/markdeep-slides.js"></script>

<!-- Markdeep stuff -->
<script>
    markdeepOptions = {
        tocStyle: 'none',
        detectMath: false,
        onLoad: function() {
            initSlides();
        }
    };
</script>
<style class="fallback">body{visibility:hidden;white-space:pre;font-family:monospace}</style>
<script src="../markdeep-slides/lib/markdeep/1.11/markdeep.min.js" charset="utf-8"></script>
<script>window.alreadyProcessedMarkdeep||(document.body.style.visibility="visible")</script>

Options for a progress bar location

It is a feature request to consider. I would like to have the progress bar be directly below the slide title. If you look at the Metropolis theme for Beamer, they have options to place it at the top of a slide (like it is now), at the bottom, or under the title.

I don't know JS but I could probably take a stab at it if you could perhaps provide me with some pointers...

'n' doesn't work

'n' doesn't work in the demo.
The error on the console is:
ncaught ReferenceError: theme is not defined
at togglePresenterNotes (markdeep-slides.js:497)
at HTMLBodyElement.keyPress (markdeep-slides.js:

Chrome or Firefox, MacOSX

Fix incorrect slide dimensions when "old-style" scroll bars are enabled

As mentioned by @dirkk0 in #22.

Turns out that when scroll bars are set to always be visible and thus take up space (or the user is on an OS that always shows scroll bars), the slides aren't sized properly. This is bad because:

  • In draft mode, a horizontal scroll bar is visible because the slides continue horizontally just a bit behind the vertical scroll bar.
  • In presentation mode, a vertical scroll bar is visible. I'm not yet sure why exactly this is.

I didn't notice this during development because I'm using macOS on a laptop, where scroll bars are overlaid onto the content only when scrolling and don't interfere with the viewport.

I'll try to address this soon.

Add optional footer line

Many slide decks out in the wild have a footer line that's shown at the bottom of each slide. It typically contains the name of the presenter and their affiliation.

This would be implemented as a null-by-default option.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.