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 🙏

© 2026 – Pkg Stats / Ryan Hefner

markdown-it-vitepress-encrypt

v0.1.0

Published

A markdown-it plugin for VitePress to encrypt private pages by frontmatter.

Readme

markdown-it-vitepress-encrypt(中文说明)

一个用于 VitePress 的 markdown-it 插件:通过页面 frontmatter 标记把页面内容加密,访问时输入密码(或通过 URL / 本地缓存)解密显示。

注意:这是 纯前端加解密 方案。构建产物会下发加密内容,并在浏览器端解密展示。请不要把它当作服务端权限控制。

安装

npm i markdown-it-vitepress-encrypt crypto-js

在 VitePress 中使用

在 .vitepress/config.(js|ts) 中启用:

import vitepressEncrypt from 'markdown-it-vitepress-encrypt'

export default {
  markdown: {
    config(md) {
      md.use(vitepressEncrypt, { password: 'your-password' })
    }
  }
}

也支持按 pageType 配置多个密码:

md.use(vitepressEncrypt, [
  { pageType: 'default', password: 'p1' },
  { pageType: 'vip', password: 'p2' }
])

页面 frontmatter 配置

在需要加密的页面顶部添加:

---
encrypt: true
encrypt-input: true
encrypt-pageType: default
encrypt-storage: true
---
  • encrypt:为 true 时启用加密(必填)
  • encrypt-input:是否显示密码输入框,默认 true;设为 false 会隐藏输入框(仍可通过 URL 解锁)
  • encrypt-pageType:用于匹配不同密码规则;默认 default
  • encrypt-storage:是否在 localStorage 读写密码(默认 true);设为 false 可禁用本地保存/自动读取

解锁方式

插件会按顺序尝试:

  • localStorage:__ENCRYPT__${pageType}__(仅当 encrypt-storage: true)
  • URL 参数:?key=xxxx

解锁成功后会把密码写入 localStorage(仅当 encrypt-storage: true,便于同一 pageType 下次自动解锁)。

安全说明

  • 该插件保护的是构建产物中的 HTML 渲染结果(加密存放/展示),但加密内容仍会随页面下发到浏览器。
  • 任何拿到密码的人都可以解密,适合“轻量隐藏内容”,不适合高安全场景的访问控制。

License

MIT