remark-css-selectors

LIB

-

nject class and ID attributes into Markdown AST

remark-css-selectors is a plugin for Remark that enables you to attach custom class names and id attributes to Markdown elements via HTML-style comment selectors.

Example usage:

<!-- p:first-of-type -->
This paragraph will have a class.

This plugin modifies the Markdown AST (Abstract Syntax Tree) to include data-css attributes, which can be used for styling after the Markdown is converted to HTML.

Features:

  • Selector-style syntax via comments
  • Adds class or ID via data-css attributes
  • Simple Babel-based build (no Webpack)
  • Works within the Unified/Remark ecosystem