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

ezmdpage

v2.0.3

Published

๐Ÿ“ Write raw Markdown in .html files that gets auto-rendered everywhere

Downloads

14

Readme

Easy self-rendering Markdown pages

๐Ÿ“ Write raw Markdown in .html files that gets auto-rendered everywhere
๐Ÿ’ก Inspired by markdeep

Test page | ezmdpage & Alpine.js | ezmdpage & Vue.js

๐Ÿ“‚ Works with file:///document.html documents
๐Ÿ“œ Failsafe text fallback when JavaScript is disabled
๐ŸŽจ Styled using GitHub's Markdown CSS
๐Ÿ๏ธ Works offline!

Installation

unpkg.com jsDelivr

You can Ctrl+S the ezmdpage.min.js file to download it and load it locally (for offline use) or use an npm CDN like unpkg.com or jsDelivr to load it from the web:

<script src="ezmdpage.min.js"></script><plaintext>
<script src="https://unpkg.com/ezmdpage@2"></script><plaintext>
<script src="https://cdn.jsdelivr.net/npm/ezmdpage@2"></script><plaintext>

To get the best editing experience, you can configure Prettier or your other favorite formatter to use its Markdown parser/beautifier on .html files.

// package.json
{
  "prettier": {
    "overrides": [
      {
        "files": ["*.html"],
        "options": {
          "parser": "markdown"
        }
      }
    ]
  }
}

๐Ÿ’ก You can also use a custom suffix like .ezmdpage.html or something if you have other non-ezmdpage HTML content in your workspace too.

โš›๏ธ To get proper syntax highlighting in VS Code, you'll need to configure it to use its Markdown mode for .html files. You can do this by adding this to your .vscode/settings.json file:

{
  "files.associations": {
    "*.html": "markdown"
  }
}

โš ๏ธ This project is intended to be used on a plain HTML page. It may not work with other non-Markdown content on the page.

Usage

Markdown Browser

After adding the magic <script> to your .md.html file, you can get started editing your document in ernest! You can use any relgular old text editor to compose your markdown; even Windows Notepad works great! ezmdpage even works with local file: URLs: you can just email or share a plain .html file with someone, and they will be able to open and view it.

<script src="https://unpkg.com/ezmdpage@2"></script><plaintext>

# Hello world!

This is my **Markdown document**! There's some <mark>HTML</mark> elements in
here <u>too</u> since Markdown supports _inline HTML_.

| Look at this cool ๐Ÿ˜Ž GFM table! | Wow!                |
| ------------------------------- | ------------------- |
| We can even do math!            | $ax^2 + bx + c = 0$ |

```js
console.log("Code highlighting works too!");
```

> All other Markdown features work as expected.

<script>
  // You can even use <script> tags! There's NO SAFETY FILTER for HTML elements.
  const html = `<p>It's ${new Date().toLocaleTimeString()}!</p>`;
  document.body.append(document.createRange().createContextualFragment(html));
</script>

๐Ÿคฉ For more cool examples like using Alpine.js with ezmdpage, check out the GitHub Pages site which hosts the test/ folder demos!

Development

JavaScript CSS Vite

This project uses Vite to create a IIFE bundle of all the CSS and JavaScript that gets injected into the page. It's basically just Marked & HighlightJS. We use vite-plugin-css-injected-by-js to inline the CSS into the JavaScript bundle.

โ„น Note that we use the main field in package.json and not the new exports field. This is because unpkg.com doesn't support the new exports field. See mjackson/unpkg#265. unpkg.com is the most popular CDN for non-ESM npm packages, so it makes sense to bend over backwards to support it.