reveal-compiler-explorer

3.3.0 • Public • Published

reveal-compiler-explorer

npm version npm publish

A Reveal.js plugin for opening code snippets in Compiler Explorer by clicking on them.

Check out the live demo.

For testing presentation code, see reveal-test package.


Installation

  1. Download and install the package in your project:

    npm install --save reveal-compiler-explorer
    

    or

    yarn add reveal-compiler-explorer
    

    or just download dist/reveal-compiler-explorer.js into the plugin folder of your reveal.js presentation, e.g.. plugins/reveal-compiler-explorer.

  2. Add the plugins to the dependencies in your presentation

    <script src="node_modules/reveal-compiler-explorer/dist/reveal-compiler-explorer.js"></script>
    // ...
    Reveal.initialize({
      // ...
      plugins: [
          RevealMarkdown,
          RevealCompilerExplorer,
          RevealHighlight,
      ]
    });

    Note that the plugin should come before the highlight plugin.

    If you're using reveal-md you can add a script to load the plugin:

    options.plugins.splice(options.plugins.indexOf(RevealHighlight), 0, RevealCompilerExplorer);

    and then add a reference to this script along with node_modules/reveal-compiler-explorer/dist/reveal-compiler-explorer.js to the scripts object inside reveal-md.json config file.

For reference, take a look at the demo package in this repo.


Configuration

To configure the plugin pass a compilerExplorer object to Reveal.initialize with any of the options from here.

For example

// ...
Reveal.initialize({
  // ...
  plugins: [
    // ...
    RevealCompilerExplorer
    // ...
  ],
  // ...
  compilerExplorer: {
    compiler: "g83",
    runMain: false
  }
});

Directives

In addition to the directives mentioned here, the following directives are supported:

///hide

Hides the following code, until the next ///unhide or end of the snippet, from presentation.

///unhide

Revert code hiding.

The directives will not be shown on the presentation.

Package Sidebar

Install

npm i reveal-compiler-explorer

Weekly Downloads

12

Version

3.3.0

License

MIT

Unpacked Size

242 kB

Total Files

7

Last publish

Collaborators

  • dvirtz