reveal-compiler-explorer

    1.6.2 • 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.

    Install

    npm i reveal-compiler-explorer

    DownloadsWeekly Downloads

    3

    Version

    1.6.2

    License

    MIT

    Unpacked Size

    1.16 MB

    Total Files

    11

    Last publish

    Collaborators

    • dvirtz