Git Product home page Git Product logo

reveal.js-railroad's Introduction

Reveal.js Railroad-diagram

Version

A reveal.js plugin that adds support for Railroad-diagrams. It is a thin wrapper around the amazing Railroad-diagram Generator project.


<script type="application/railroad">
  Diagram(
    'function',
    NonTerminal('identifier'),
    '(', ZeroOrMore('param', ','), ')',
    '{', ZeroOrMore(NonTerminal('statement')), '}');
</script>

Important notes:

  • We chose the "holder" to be <script type="application/railroad">
  • The containment script is executed using eval. This could be an enormous security risk if you don't know the authors of your slides.

Quickstart

Installation

This plugin is published to, and can be installed from, npm.

npm install add @edc4it/reveal.js-railroad

Or using yarn

yarn add @edc4it/reveal.js-railroad

Initialise (as npm library)

import Reveal from 'reveal.js';
import ClipCode from '@edc4it/reveal.js-clipcode';

Reveal.initialize({
  railroad: {
    // Default values
    bg: 'unset',
    pathStroke: '#82e4ff',
    rectFill: '#00a6ff',
    rectStroke: 'white',
    textFill: 'white',
  },
  plugins: [RailRoad],
});

Add a diagram

For the full syntax of "components" see Railroad-Diagram components

<script type="application/railroad">
  Diagram(
    'function',
    NonTerminal('identifier'),
    '(', ZeroOrMore('param', ','), ')',
    '{', ZeroOrMore(NonTerminal('statement')), '}');
</script>

Global options

Reveal.initialize({
  railroad: {
    // Default values
    bg: 'unset',
    pathStroke: '#82e4ff',
    rectFill: '#00a6ff',
    rectStroke: 'white',
    textFill: 'white',
  },
  plugins: [RailRoad],
});
  • bg: the background of the diagram
  • pathStroke: the color used for the "path" of the railroad diagram,
  • rectFill: 'the fill/background color of the components
  • rectStroke: 'the stroke color of the components,
  • textFill: color of the text inside the components,

reveal.js-railroad's People

Contributors

rparree avatar dependabot[bot] avatar

Stargazers

Daniel Zhang avatar TwoPinkyNoBrain avatar

Watchers

 avatar Jorden de Bouve avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.