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

gh-preview

v1.0.0-next

Published

[![npm version](https://badge.fury.io/js/gh-preview.svg)](http://badge.fury.io/js/gh-preview)

Downloads

5

Readme

Github Markdown Preview

npm version

Preview Github markdown - as you type

preview

The most exciting part in a project's lifetime is bragging about how awesome it is, usually in it's README file. However, to get the wording and formatting just right, one would need to write the file using Github's online editor, switching back and forth between editing and previewing, loosing all the efficiencies of using a copy of the vim text editor.

Features

  • Preview rendered markdown as you type
  • Output is rendered as if it was already on github
  • Editor-friendly
  • Since v0.2.2: Scroll synchronization, inspired by Ghost.

Getting started

The server is running on node and requires npm to install:

$ npm install -g gh-preview

To run the server manually, use the gh-preview command. Note that the vim plugin will start the server automatically if it is not already running at the given port.

Usage:
  gh-preview [--port=<port>]

Options:
  -p, --port=<port>  The port to bind to [Default: 1234]

Editor integration

Where is my editor?

Feel free to contribute an editor plugin for your favourite editor and open an issue on github to have it mentioned here.

How to write an editor plugin?

Simply have your editor perform HTTP POST requests to the running gh-preview instance. The plugin may optionally start a new gh-preview server. For command line usage, refer to the README.

To see an example usage, check out the tests and the vim plugin. From the tests:

import request from 'request';
request.post({
  url:  'localhost:${ port }/api/doc'
, json: { 'file': '/bar/foo.md'
        , 'markdown': '# Foo!' }});

This will create a document titled foo.md, with the markdown being # Foo!. The markdown will then be rendered on the client, as served by the gh-preview server.

Caveats

Github uses pygments for their syntax highlighting, whereas this project uses highlight.js - which, while awesome - is not pygments and differences are bound to occur.

Random wishlist

Since this a very purpose-driven project - that is to be able to interactively preview markdown files before publishing to github - work on this project is not focused and hence the following items, albeit relatively simple tasks, are likely to remain wishes for the future to come.

  • [ ] Show the caret in the output
  • [ ] Anchor tag support for permalinks in headings
  • [ ] Implement :GhPreviewOpenBrowser command for vim
  • [ ] Implement :GhPreviewStart command for vim
  • [ ] Implement :GhPreviewStop command for vim
  • [ ] Improve error reporting if the server goes away, etc.
  • [ ] Improve scroll synchronization

Contributing

Business as usual. Get started by running the test suite:

git clone [email protected]:felixschl/gh-preview
cd gh-preview
npm install -g gulp
npm install
gulp
npm test

Then fix bug / add feature and submit a pull request.