It also eavesdropped on me, and so I decided to see if I could do a Google search and spliced my way through it.
The main Reveal.js div as follows:
<body> <div class="reveal"> <div class="slides"> <section data-markdown="somefile" data-separator="^\n\n\n" data-vertical="^\n\n" data-notes="^Note:"> </section> </div> </div> <script src="reveal.js/lib/js/head.min.js"></script> <script src="reveal.js/js/reveal.min.js"></script> <script> </script> </body>
Easy way (manually enter the full file name)
We can dynamically set an attribute, for example. data-markdown in a <section> element with JavaScript. There are two small obstacles here: we must do this after creating the element, but before Reveal.js does its initialization, otherwise the internal state of the DOM and Reveal.js will fail. It is quite simple (only showing the modified section):
<div class="slides"> <section id="presentation" data-separator="^\n\n\n" data-vertical="^\n\n" data-notes="^Note:"> </section> <script type="text/javascript"> document.getElementById("presentation").setAttribute("data-markdown",prompt("Filename:","default-filename.md")); </script>
When you load the page, you get a small warning / prompt in which you enter the full file name (relative to the web server root). If you do what I do and use python -m'SimpleHTTPServer to start the local web server directly in the directory with all the slides, then this is not so bad.
Difficult path (file selection dialog)
A simple way is a good start, but it is not as convenient as a fully graphical choice. Fortunately, it turns out that we can do this too. The tough part here is that we have to start the file selector after the page is fully loaded and displayed, which means we have to do something to get the state of Reveal.js with DOM support. The API has a sync() method, which should be useful only for such situations, but for some reason it does not work. Instead, we delay the full initialization of Reveal.js until we install the external Markdown file:
<body> <input type="file" id="external_md" name="markdown" > <div class="reveal"> <div class="slides"> <section id="presentation" data-separator="^\n\n\n" data-vertical="^\n\n" data-notes="^Note:"> </section> <script type="text/javascript"> function selectFile(evt) { </script> </div> </div> <script src="reveal.js/lib/js/head.min.js"></script> <script src="reveal.js/js/reveal.min.js"></script> <script> </script> </body>
These are three areas of change: 1. Adding an <input> element to control file selection. 2. Optional Javascript in the middle. 3. End the call to Reveal.initialize() with a dummy function to delay initialization.
All of this worked for me with the current version of Reveal.js ( 9cf7de54b8f ). Please note that I save all Reveal.js material in the reveal.js , so you may need to configure the paths accordingly.