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

@mryhryki/markdown-preview

v0.8.7

Published

Markdown realtime preview on browser with your favorite editor

Downloads

149

Readme

markdown-preview

Markdown realtime preview on browser with your favorite editor.

Concept

Demo

Usage

npx

$ npx @mryhryki/markdown-preview
Version        : v0.6.0
Root Directory : /current/dir
Default File   : README.md
Extensions     : md, markdown
Template File  : /path/to/template/default.html
Preview URL    : http://localhost:34567

npm / yarn (install)

$ npm install -g @mryhryki/markdown-preview
# or
$ yarn install -g @mryhryki/markdown-preview

$ markdown-preview
Version        : v0.6.0
Root Directory : /current/dir
Default File   : README.md
Extensions     : md, markdown
Template File  : /path/to/template/default-dark.html
Preview URL    : http://localhost:34567

Parameter

| short | long | environment variable | parameter | required | default | |-------|--------------|-----------------------------|-------------------------------------------------------|----------|-------------| | -f | --file | MARKDOWN_PREVIEW_FILE | relative file path | no | README.md | | -e | --extensions | MARKDOWN_PREVIEW_EXTENSIONS | comma separated extensions | no | md,markdown | | -t | --template | MARKDOWN_PREVIEW_TEMPLATE | defined template name (*1) or template file path (*2) | no | default | | -p | --port | MARKDOWN_PREVIEW_PORT | port number | no | 34567 | | | --log-level | MARKDOWN_PREVIEW_LOG_LEVEL | trace, debug, infowarn, error, fatal | no | info | | | --no-opener | MARKDOWN_PREVIEW_NO_OPENER | true (only env var) | no | | | -v | --version | | | no | | | -h | --help | | | no | |

*1: Defined Template Names

  • default

*2: How to create a template file

You just need to load /markdown-preview-websocket.js and register a callback to connectMarkdownPreview.

A simple example code is below:

<!doctype html>
<html>
  <head>
    <title>Minimum Template Sample</title>
  </head>
  <body>
    <pre id="raw-markdown"></pre>
    <script type="module">
      import { connectMarkdownPreview } from "/markdown-preview-websocket.js";
      connectMarkdownPreview(({ markdown }) => {
        document.getElementById('raw-markdown').innerHTML =
          markdown.replace(/</g, '&lt;').replace(/>/g, '&gt;');
      });
    </script>
  </body>
</html>

Development

$ npm install

# Watch mode
$ npm run dev

# Build and Run
$ npm start

# Test
$ npm test
$ npm run test:watch

# Type check
$ npm run type
$ npm run type:watch

# Check code format
$ npm run lint

# Formatter
$ npm run fmt

Release

Run release workflow.