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

rehype-prefixwords

v1.1.0

Published

Rehype plugins that assigns classes to emphasised words based on prefixes or suffixes

Downloads

14

Readme

rehype-prefixwords

Rehype plugin to style emphasised (e.g. *word* in MD or <em> in HTML) words depending on specified prefixes or suffixes.

Example Usage

This project is also tested to be compatible with astro markdown

# Header 

*transgender*

*transform*

nonrelevant
*non-exclusionary*

*lesbian*
*debian*
import fs from 'node:fs/promises'
import { reporter } from 'vfile-reporter'
import { unified } from 'unified'
import rehypePrefixWords from 'rehype-prefixwords'
import rehypeDocument from 'rehype-document'
import rehypeFormat from 'rehype-format'
import rehypeStringify from 'rehype-stringify'
import remarkRehype from 'remark-rehype'
import remarkParse from 'remark-parse'
const document = await fs.readFile('./src/TEST.md', 'utf8');

const file = await unified()
  .use(remarkParse)
  .use(remarkRehype)
  .use(rehypePrefixWords, {
  prefixes: [
    ["trans", "transgender"],
    ["non", "nonbinary"]
  ],
  suffixes: [
    ["bian", "lesbian"]
  ]})
  .use(rehypeDocument)
  .use(rehypeFormat)
  .use(rehypeStringify)
  .process(document)

console.error(reporter(file))

Gradient stolen from gaydient

em.transgender {
    background: linear-gradient(to right, rgb(85, 205, 252), rgb(179, 157, 233), rgb(247, 168, 184), rgb(246, 216, 221), rgb(255, 255, 255) 45%, rgb(255, 255, 255), rgb(255, 255, 255) 55%, rgb(246, 216, 221), rgb(247, 168, 184), rgb(179, 157, 233), rgb(85, 205, 252));
    background-clip: text;
    color: transparent;
    font-style: normal;
}
em.nonbinary {
    background: linear-gradient(to right, rgb(253, 219, 0), rgb(238, 212, 143), rgb(255, 255, 255) 30%, rgb(255, 255, 255), rgb(255, 255, 255) 36%, rgb(212, 181, 222), rgb(156, 92, 212), rgb(88, 50, 96), rgb(0, 0, 0));
    background-clip: text;
    color: transparent;
    font-style: normal;
}
em.lesbian {
    background: linear-gradient(to right, rgb(213, 44, 0), rgb(226, 150, 136), rgb(255, 255, 255) 45%, rgb(255, 255, 255), rgb(255, 255, 255) 55%, rgb(210, 127, 164), rgb(162, 2, 98));
    background-clip: text;
    color: transparent;
    font-style: normal;
}

License

This project is dual-licensed under either the AGPL-3.0 or the OQL-1.1, of your choice