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 🙏

© 2025 – Pkg Stats / Ryan Hefner

vuepress-plugin-netabare-switch

v1.0.1

Published

VuePress v2 Plugin - netabare switch (ネタバレ・スイッチ)

Readme

VuePress Plugin NetaBare Switch

Toggle switch for ネタバレ (NetaBare)

ネタバレ (NetaBare) means spoiler

Articles using this plugin toggle showing the NetaBare sentences.

This plugin is for VuePress v2

Recommendation

Styles in components are written by Tailwind CSS. Adding Windi CSS is recommended.

If you use vuepress with Vite

npm install -D windicss vite-plugin-windicss
// config.ts
import { defineUserConfig } from 'vuepress'
import { viteBundler } from 'vuepress'
import { defaultTheme } from 'vuepress'
import WindiCSS from 'vite-plugin-windicss'
import { netabareSwitchPlugin } from 'vuepress-plugin-netabare-switch'

export default defineUserConfig({
  bundler: viteBundler({
    viteOptions: {
      plugins: [
        WindiCSS(
          scan: {
            include: [
              path.resolve(__dirname, './**/*.{vue,html,md}'),
              path.resolve(__dirname, '../../node_modules/vuepress-plugin-netabare-switch/lib/**/*.{vue,html,md}'),
            ],
            exclude: [
              'node_modules/**/*',
              '.git/**/*',
            ],
          },
        ),
      ],
    },
  }),
  plugins: [netabareSwitchPlugin()],
})

Install

$ npm install -D vuepress-plugin-netabare-switch

or

$ yarn add -D vuepress-plugin-netabare-switch

Usage

Add vuepress-plugin-netabare-switch in your config file.

Since version 1.0.1 is for VuePress 2.0.0-beta.40 or later. Usage of plugins is changed.

// config.ts
import { defineUserConfig } from 'vuepress'
import { netabareSwitchPlugin } from 'vuepress-plugin-netabare-switch'

export default defineUserConfig({
  plugins: [
    netabareSwitchPlugin(), // add
  ],
})

in your article file (.md)

<NetaBareSwitch>Show spoiler</NetaBareSwitch>

and writing like below:

## The culprit is <NetaBareSpan bare="Mr. Foo">◯◯</NetaBareSpan>

<NetaBareDiv>

Message that do not contain spoilers is here.
It is recommended that the first line be a blank line for markdown parser.
</NetaBareDiv>

<NetaBareDiv bare>

Message containing spoilers is here.
</NetaBareDiv>

<NetaBareDiv bare :isBare="false">

Message that do not contain spoilers is here.
`isBare` prop takes priority of `bare` attribute.
</NetaBareDiv>

NetaBare Switch

Options

plugins: [
  netabareSwitchPlugin({
    // Prefix of keys for LocalStorage
    // default: 'netabare'
    keyPrefix: 'nb',

    // Prefix of components name
    // default: 'NetaBare'
    componentPrefix: 'NB', // -> `<NBSwitch/>`
  }),
],

Component Slots, Props ,and Attributes

<NetaBareSwitch>: Toggle switch.

#default slot is message to toggle NetaBare

Default is in Japanese.

name?: string prop

using for <input type=checkbox class="toggle-checkbox"> id and storage key

CSS

<div :class="switchWrapperClass">
  <input type=checkbox class="toggle-checkbox" :class="buttonClass" />
  <label class="toggle-label" :class="switchBgClass" />
</div>
<label :class="labelClass">
  <slot name="default" />
</label>
.toggle-checkbox {
  background-color: var(--c-text);
}
.toggle-checkbox:checked {
  right: 0;
  background-color: var(--c-tip-bg);
}
.toggle-checkbox + .toggle-label {
  box-sizing: border-box;
  border: 1px solid var(--c-tip);
  background-color: var(--c-tip-bg);
}
.toggle-checkbox:checked + .toggle-label {
  background-color: var(--c-tip);
}

<NetaBareDiv>: Div of spoiler

#default slot is paragraph including/excluding spoiler.

isBare?: boolean prop

If true, messages in the default slot are including spoiler. If false, without spoiler even if bare attribute exists.

bare attribute

If exists, messages in the default slot are including spoiler.

<NetaBareSpan>: Span of spoiler

#default slot is words excluding spoiler.

bare prop is words including spoiler.

Reference

License

MIT