Skip to content

Doc: Add CDN based (installation-free) usage example #2893

@Izhaki

Description

@Izhaki

I think it would be very useful to include a CDN based usage example, so people can get started with reveal.js without having to go through any installation procedure (which are really for developers, not consumers of reveal.js):

<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">

    <title>Reveal CDN example</title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/4.1.0/reveal.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/4.1.0/theme/simple.css" id="theme">
</head>

<body>

    <div class="reveal">

        <div class="slides">

            <section>
                <h1>Bayes Rule</h1>
                $$
                p(y|x) = \frac{p(x|y) \cdot p(y)}{p(x)}
                $$
            </section>

        </div>

    </div>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/4.1.0/reveal.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/4.1.0/plugin/math/math.js"></script>
    <script>
        Reveal.initialize({
            history: true,
            transition: 'linear',

            math: {
                // mathjax: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js',
                config: 'TeX-AMS_HTML-full',
                TeX: {
                    Macros: {
                        R: '\\mathbb{R}',
                        set: ['\\left\\{#1 \\; ; \\; #2\\right\\}', 2]
                    }
                }
            },

            plugins: [RevealMath]
        });
    </script>

</body>

</html>

I came across this project a few days ago, and only after cloning locally I've noticed that the demo and examples simply point to dist and can be loaded directly in the browser - nothing else needed. So simply point your js/css to a CDN instead of the dist folder and done.

Had to dig into some issues in this repo to figure out how to do this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions