Add extras plugin

To make loading of extras/ addons simpler, and remove cruft from
presentation html files, I created a new plugin src/plugins/extras/.

If any of the extra addons (highlight.js, markdown.js, mathjax.js
or mermaid.js) are added to the html file with a regular <script> tag,
then this module will discover and know how to init the module for you,
so it is not necessary to do that in html. If you're not using
the extras, this plugin does nothing.

Note that in the branch history where you are reading this commit,
the extras/ directory doesn't actually exist yet, nor do the
examples/ that use them. But they will hopefully join this branch soon.
This commit is contained in:
Henrik Ingo
2017-10-23 23:08:14 +03:00
parent 2757613fd4
commit 78c412cace
2 changed files with 95 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
Extras Plugin
=============
The Extras plugin will initialize the optional addon plugins from
[extras/](../../../extras/) directory, if they were loaded.
Generally, for an extras plugin to have been loaded, 2 things must have happened:
1. The extras plugins must be present in extras/ directory, for example after
running `git submodule update`
2. One or more extras plugins are added to the impress.js presentation (the HTML
file) by the author using a regular `<script>` tag.
If one or more extras plugins were so added, this plugin will automatically
discover them and perform initialization (such as calling
`mermaid.initialize()`).
If no extras plugins are added to a presentation, this plugin does nothing.
Note that some extra plugins (like mathjax) initialize themselves immediately, and
there's nothing to do here.
Author
------
Henrik Ingo (@henrikingo), 2016