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.js-doghouse

v1.0.1

Published

A plugin for Reveal.js 4 that will render inline Pug codeblocks for presentations with live editing.

Downloads

7

Readme

Doghouse

Version Downloads

A plugin for Reveal.js 4 that will render Pug codeblocks when it starts, but it also works with live editing, which makes it great for presentations about Pug.

Screenshot

Doghouse uses the standalone, latest version of Pug (as described here: github.com/pugjs/pug). To avoid needing to use DogPack and get all kinds of issues with importers and modules, this plugin uses Require.js.

Demo

Doghouse only does one thing: it renders Pug codeblocks, and can update them live.

Installation

Copy the doghouse folder to the plugins folder of the reveal.js folder, like this: plugin/doghouse.

npm installation

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

npm install reveal.js-doghouse

The Doghouse plugin folder can then be referenced from node_modules/reveal.js-doghouse/plugin/doghouse. Next to the Doghouse plugin, you will need Pug.js (included in this package at node_modules/reveal.js-doghouse/plugin/pug/pug.js) and Require.js. The latter is on different CDNs, this example uses a CDN called Unpkg.

Setup

JavaScript

The Doghouse plugin has been written for Reveal.js version 4.

There are two JavaScript files for Doghouse, a regular one, doghouse.js, and a module one, doghouse.esm.js. You only need one of them:

Regular

If you're not using ES modules, for example, to be able to run your presentation from the filesystem, you can add it like this:

<script type="text/javascript" src="dist/reveal.js"></script>
<script src="plugin/doghouse/doghouse"></script>
<script>
    Reveal.initialize({
        // ...
        plugins: [ Doghouse ]
    });
</script>
// Now you will also need 'Require.js'
<script src="https://unpkg.com/[email protected]/require.js"></script>
<script>
    require({paths: {pug: "./plugin/pug/pug"}}, ["pug"],
        function() {
            pug = require('pug');
            window.pug = pug;
    });
</script>

The order is important here. I don't know why.

As a module

If you're using ES modules, you can add it like this:

<script type="module">
    // This will need a server
    import Reveal from './dist/reveal.esm.js';
    import Doghouse from './plugin/doghouse/doghouse.esm.js';
    Reveal.initialize({
        // ...
        plugins: [ Doghouse ]
    });
</script>

// This also needs 'Require.js'
<script src="https://unpkg.com/[email protected]/require.js"></script>
<script>
    require({paths: {pug: "./plugin/pug/pug"}}, ["pug"],
        function() {
            pug = require('pug');
            window.pug = pug;
    });
</script>

As you can see, you still need Require.js and the require script, because using ‘import Pug from "./plugin/pug/pug"’ results in errors. If you're a wizard in imports/exports and ES6, maybe you can help improving this plugin.

HTML

Doghouse looks for sets of codeblocks. Each set should get a data-attribute of data-doghouse. Inside each set, Doghouse looks for a Pug source codeblock (data-doghouse-pug), an HTML codeblock where the HTML ends up (data-doghouse-html), and an optional data codeblock (data-doghouse-data), used to show how locals can be used.

<div data-doghouse>
    <pre>
        <code contenteditable="true" data-doghouse-pug>
            ul
                li Item 1
                li Item 2
        </code>
    </pre>
    <pre>
        <code data-doghouse-html>
        </code>
    </pre>
</div>

The above example will then render this in the second codeblock:

<ul>
    <li>Item 1</li>
    <li>Item 2</li>
</ul>

See the demo for a full example.

Like it?

If you like it, please star this repo!

And if you want to show off what you made with it, please do :-)

License

MIT licensed

Copyright (C) 2021 Martijn De Jongh (Martino)