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

remark-inline-code-class

v1.1.5

Published

remark plugin to assign a class name to an inline code element

Readme

remark-inline-code-class

Remark plugin that lets you assign class names to inline code elements. This way you can style inline code elements by class.

For example, on SVG-Tutorial.com, the elements are highlighted in green, the properties are highlighted in purple, and the values are highlighted in blue. Link to live example.

example image

With this plugin we can write our markdown as follows:

The `element:circle` element's radius is set with the `property:r` property.

The result will be as follows:

The <code class="element">circle</code> element's radius is set with the
<code class="property">r</code> property.

This plugin doesn't do any styling on its own, but you can define your style for example as follows:

code {
  padding: 2px 5px;
  border-radius: 2px;
  border: 1px solid;
}

code.element {
  border-color: rgb(133, 232, 157, 1);
  background-color: rgb(133, 232, 157, 0.1);
}

code.property {
  border-color: rgb(179, 146, 240, 1);
  background-color: rgb(179, 146, 240, 0.1);
}

code.value {
  border-color: rgb(158, 203, 255, 1);
  background-color: rgb(158, 203, 255, 0.1);
}

Installation

npm install remark-inline-code-class

Usage with Astro

Extend your Astro config file:

import { defineConfig } from "astro/config";
import remarkInlineCodeClass from "remark-inline-code-class";

// https://astro.build/config
export default defineConfig({
  markdown: {
    remarkPlugins: [remarkInlineCodeClass],
  },
});

Then define your class styles with global CSS.

Usage with Unified

This package is a unified remark plugin so you can also use it as follows:

import { unified } from "unified";
import remarkParse from "remark-parse";
import remarkStringify from "remark-stringify";
import remarkInlineCodeClass from "remark-inline-code-class";

const file = await unified()
  .use(remarkParse)
  .use(remarkInlineCodeClass)
  .use(remarkStringify)
  .process('This is an inline `red:element` with the class "red"');

console.log(String(file));

Options

The plugin lets you set the inlineClass string option that sets a class for every inline code element.

This is useful, when you want to threat inline code elements separate from code blocks:

<p>This is an inline <code class="inline">code</code> element</p>
<pre>
  <code>
    And this is a code block.
  </code>
</pre>

You can set it in the Astro config file:

import { defineConfig } from "astro/config";
import remarkInlineCodeClass from "remark-inline-code-class";

// https://astro.build/config
export default defineConfig({
  markdown: {
    remarkPlugins: [[remarkInlineCodeClass, { inlineClass: "inline" }]],
  },
});

Or when using it with Unist:

import { unified } from "unified";
import remarkParse from "remark-parse";
import remarkStringify from "remark-stringify";
import remarkInlineCodeClass from "remark-inline-code-class";

const file = await unified()
  .use(remarkParse)
  .use(remarkInlineCodeClass, { inlineClass: "inline" })
  .use(remarkStringify)
  .process('This is an inline `red:element` with the class "red"');

console.log(String(file));

How does it work?

Read more about it on my tech blog.

License

MIT © Hunor Márton Borbély