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

doctop

v1.0.0

Published

Doctop

Downloads

6

Readme

Doctop

A jQuery plugin for consuming Google Docs via JSON

Getting Started

Download the production version or the development version.

Create a Google Docs document, using the "Heading 1" format to denote sections of the document. Publish it to the web via File->Publish to the web->Publish.

In your web page:

<script src="jquery.js"></script>
<script src="dist/doctop.min.js"></script>
<script>
  $.doctop({
    url: 'https://docs.google.com/document/d/1_zs07o2m1BQisqWT5WEk_aC4TFl9nIZgufc9IYeL64Y/pub',
    callback: function(d){console.dir(d);},
  });
</script>

Returns:

{
  "copy": {
    "h1-1": [
      "This is a paragraph of text",
      "this is another paragraph",
      "h2-1" [
        "this should be a child of h2-1, which should be a child of h1-1",
        "h3-1": [
          "This should be a child of h3-1, which should be a child of h2-1"
        ]
      ]
    ],
    "h1-2": [
      "This should be a child of h1-2, which itself should be in the top level of the object.",
      "h3-2": [
        "This should be a child of h3-2, which should be a child of h1-2"
      ]
    ],
    "h1-3": [
      "This should be a child of h1-3",
      "Another child of h1-3"
    ]
  }
}

Documentation

### Options

url (required)

The full URL of a published Google Doc. In Google Docs, go "File->Publish to the Web->Publish" to get this URL.

callback (required)

Asynchronous callback for the data. Takes one argument, the response, containing copy and any Tabletop data. The this context is the contents of response.copy.

tabletop_url (default: undefined)

If you have Tabletop.js included on the page, you can supply a published Google Sheets URL in order to only need one callback. The Tabletop response will be in the "data" key of the returned object, i.e, spreadsheet data in data.data, Tabletop object in data.tabletop.

tabletop_proxy (default: undefined)

If you're using Tabletop with Doctop, you can specify the Tabletop proxy here. Note this only works for Google Sheets that have been copied to S3 or elsewhere; Doctop proxy support is still forthcoming.

tabletop_simplesheet (default: false)

Use Tabletop's "simpleSheet" method when grabbing that data. This only really works if you only have one sheet.

simpleKeys (default: false)

Instead of creating keys for the sections that are the slugified version of the H1 text, return keys in the format section_0 — this may be desirable if you have journalists who enjoy arbitrarily changing the H1 text on you!

preserveFormatting (default: true)

This will attempt to preserve text formatting from Google Docs. It will yield messier output because Google Docs loves to wrap everything under the sun in a <span> tag. Defaults to false.

~~returnJquery (default: false)~~ DEPRECIATED in 1.0.0

~~This returns non-H1 elements as jQuery objects instead of either HTML or text.~~

Examples

(Coming soon)

Roadmap/ToDos

  • Add the preserveFormatting option
  • Add support for other heading tags (h2-6)
  • Unit tests all up in hurr / up in hurr

Release History

1.0.0 - First stable release. Adds preserveFormatting option and tests; removes returnJquery.

0.0.2 - Adds more Tabletop features.

0.0.1 — Initial release.