npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

reveal_external

v1.3.0

Published

Plugin for reveal.js to import external sections.

Downloads

65

Readme

External.js

This is a plugin for Reveal.js. It allows you to specify external files to be loaded into a presentation. This extension also allows external files in already external files (Subfiles). It allows a course, which may be hundreds of slides, to be broken into modules and managed individually.

Installation

There are several ways to install reveal_external:

  • The manual way: Download external/external.js and save it to your project structure
  • Install with bower: bower install reveal_external
  • Install with npm: npm install reveal_external

Example

Please find the example folder in this repository for a working demo presentation.

Using external.js

Using the plugin is easy. First, register it in your Reveal.js initialize block.

{ 
    src: 'plugin/external/external.js', 
    condition: function() { 
        return !!document.querySelector( '[data-external],[data-external-replace]' ); 
    } 
},

Then simply add an element into your presentation with a data-external or data-external-replace attribute.

data-external

Will put the loaded content into the node with the data-external attribute.

<section data-external="module_01/index.html"> </section>

data-external-replace

Will replace the node with the loaded content.

<section data-external-replace="module_02/index.html"> </section>

Load Fragments

You can specify a CSS selector to add only a part of the loaded content.

<section data-external-replace="short.html#.slides > section"> </section>

Options

external: {
    async: false,
    mapAttributes: ['src']
}

async

By default the external files will be loaded synchronously. This avoids conflicts with other plugins. You can activate asynchronous loading with this option.

mapAttributes

By default the plugin will convert relative paths (dot as first character) in src attributes. This allows you to specify the path relative to the file you're in, rather then the one it is included in.

Set to false to disable, or provide an array of attribute names.

Recursion

If you want to load external files, you have to choose relative paths in the "data-external*"-attribute. In the following there is a simple example of how to include many files in one reveal presentation:

Folder structure:

  • includes
    • chapter1
      • chapter1_1
        • index1_1.html
      • chapter1_2
        • index1_2.html
      • index_1.html
    • chapter_2
      • index_2.html
    • chapter_3
      • index_3.html
  • index.html

Code of index.html:

...
<div class="reveal">
    <!-- Any section element inside of this container is displayed as a slide -->

    <div class="slides">
         <section data-external="includes/chapter1/index_1.html"> </section>
         <section data-external="includes/chapter2/index_2.html"> </section>
         <section data-external="includes/chapter3/index_3.html"> </section>
    </div> <!-- slides -->

</div> <!-- Reveal -->
...

Now you may wish to include the subchapters 1.1 and 1.2 to the content of chapter 1. This would be the code of index_1.html:

...
	<section data-external="chapter1_1/index1_1.html"> </section>
	<section data-external="chapter1_2/index1_2.html"> </section>
...

Remember that all the paths entered in "data-external" were relative!

It is also possible to include files outside of section-tags, as this would result in seperate slides. If you don't want the included content to be a new slide, you can include the content to another element, too (e.g. a div).

...
	<div data-external="chapter1_1/index1_1.html"> </div>
...

Credits

By: Jan Schoepke, originally by Cal Evans. Thanks to Thomas Weinert for massive improvements in version 1.3!

License: MIT