impress/impress.js

Allow Markdown in separate md file

henrikingo opened this issue · 2 comments

One idea I've had when creating slides with Markdown is to allow to put the Markdown text into a separate file. The impress html presentation would reference the file and its contents would be added as text content for the element. Something like:

<div id="ext-markdown" class="step slide markdown" data-rel-x="0" data-rel-y="900" data-markdown-file="content.md">

This would enable a use case where you can have an empty impress.js html presentation as a template and engine, and the úser creating the slides just writes the content.md file.

thawk commented

Maybe we can use <script type="text/template" src="xxx.md"> to include external file without introducing new attribute?

Currently, we can use <script type="text/template"> to embed markdown contents. The advantage of using <script> is that we don't need to escape </>/&...

<div class="slide markdown">
  <script type="text/template">
  We can use html tag like `<pre>` directly, don't need to escape it.
  </script>
</div>

<script> supports a src attribute, but as said at javascript - Explanation of <script type = "text/template"> ... </script> - Stack Overflow, it seems that browsers WON'T load external source, so we still have to load it manually.

I generally like the suggestion to reuse existing tag... even if overloading existing HTML tags feels a bit "potentially dangerous".

I'm not sure I follow your thinking about escaping <, >, &... It seems to me rather a disadvantage that such content would behave differently compared to the same content inside a <div class="step" ...>

Also, note that Markdown content can create multiple slides using ----- separator. But in your suggestion the markdown content is inside a div that is a step. It would be unintuitive that an element inside the div can create more div's at the parent level.

In short, I seem to prefer that we introduce a new attribute to the step div.