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

@ai-markdown/remark-mark-highlight

v1.0.2

Published

remark plugin for ==mark== highlight syntax — first-party successor to remark-mark-highlight, with dual ESM/CJS output.

Readme

@ai-markdown/remark-mark-highlight

@ai-markdown/remark-mark-highlight latest @ai-markdown/remark-mark-highlight monthly downloads TypeScript declarations included MIT license

A remark syntax plugin for highlighted text. ==text== becomes an mdast mark node whose data.hName tells remark-rehype to produce <mark>text</mark>. The package registers both parsing and Markdown serialization extensions; it does not provide CSS or an HTML sanitizer.

Use the named remarkMarkHighlight export with unified. The alias remarkMark retains the upstream export name, and lower-level micromark/mdast extensions are available for custom pipelines. Both framework adapters enable this capability through the engine’s sealed highlight plugin by default, so React and Vue applications do not need to install or register this package separately.

First-party continuation of the unmaintained remark-mark-highlight, used internally by @ai-markdown/react's sealed highlight engine plugin — published standalone because it is useful outside this repo, and because the upstream's ESM-only exports map broke bare-Node CJS require() consumers.

Install

npm install @ai-markdown/remark-mark-highlight

Dual ESM/CJS build: both import and require work, types included for both.

Use

A parse-only processor produces an mdast tree. Call parse and run rather than process, since there is no compiler in this first pipeline:

import { unified } from 'unified';
import remarkParse from 'remark-parse';
import { remarkMarkHighlight } from '@ai-markdown/remark-mark-highlight';

const processor = unified().use(remarkParse).use(remarkMarkHighlight);
const tree = processor.runSync(processor.parse('==hi=='));
// tree contains: { type: 'mark', data: { hName: 'mark' }, children: [...] }

To render HTML, add the conversion and serialization stages (install their packages alongside unified and remark-parse):

import { unified } from 'unified';
import remarkParse from 'remark-parse';
import remarkRehype from 'remark-rehype';
import rehypeStringify from 'rehype-stringify';
import { remarkMarkHighlight } from '@ai-markdown/remark-mark-highlight';

const html = unified()
  .use(remarkParse)
  .use(remarkMarkHighlight)
  .use(remarkRehype)
  .use(rehypeStringify)
  .processSync('==**bold** inside==');

console.log(String(html));
// <p><mark><strong>bold</strong> inside</mark></p>

No custom mdast-to-hast handler is required. If your full application pipeline uses rehype-sanitize, include mark in its allowed tags; the React adapter's default schema already does. For Markdown output, replace the HTML stages with remark-stringify. The plugin supplies the corresponding == serialization rules, including the escaping behavior described below.

Syntax at a glance

| Markdown | mdast | HTML | | --------------------------- | ------------------------------------------------------------ | ------------------------------------------- | | ==text== | { type: 'mark', children: [text] } | <mark>text</mark> | | ==**bold** inside== | mark → strong → text (nesting follows attention rules) | <mark><strong>bold</strong> inside</mark> | | \==not a mark== | plain text | ==not a mark== | | `==code==` | inlineCode (code spans win) | <code>==code==</code> | | =single= / ===triple=== | plain text (exactly two = open/close) | unchanged |

Works with remark-rehype out of the box (data.hName = 'mark'); no custom handler needed. If you sanitize with rehype-sanitize, allow the mark tag (the @ai-markdown/react default schema already does).

Compatibility

| | | | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------- | | unified / remark | remark 15+ (micromark 4, mdast-util-from-markdown 2, mdast-util-to-markdown 2) | | Node | ^20.19.0 \|\| >=22.12.0 | | Module formats | ESM and CJS with types for both — the upstream's ESM-only exports map broke bare-Node require(), which is one reason this fork exists | | Types | Mark is registered in mdast's PhrasingContentMap and RootContentMap, so mark nodes type-check inside paragraphs |

Behavior contract

  • Attention-style tokenizer (same family as GFM strikethrough): exactly two =, standard flanking rules, nesting with emphasis/strong, escapes and code spans respected, spans may contain line endings. Interplay with other attention extensions (e.g. GFM strikethrough) follows micromark's shared attention machinery but is not part of the pinned corpus, which runs the plugin without GFM.
  • Byte-compatible with [email protected]: a 50-case parity corpus (mdast with positions + hast), generated against the upstream before this package replaced it, runs in CI. Behavior changes would be a semver-major of this package.

Footguns

  • Loading the plugin changes how remark-stringify escapes =. The serializer registers = as unsafe in phrasing content (so == spans survive round-trips), which escapes every phrasing = — let a = b serializes as let a \= b. This matches the upstream's behavior and only affects stringify output, never parsing or rendering.

API

| Export | What | | ------------------------------------------------------- | -------------------------------------------------------------------------------------- | | remarkMarkHighlight | The remark plugin (also aliased as remarkMark, the upstream's export name) | | markHighlight() | The raw micromark extension | | markHighlightFromMarkdown / markHighlightToMarkdown | The mdast from/to-markdown extensions | | Mark (type) | The mdast node interface (type: 'mark'), registered in mdast's phrasing-content maps |

Versioning

This package versions independently of the @ai-markdown/react release train — @ai-markdown/engine depends on it through a normal semver range. Shared core and the React/Vue adapters receive it transitively.

Integration boundaries and verification

The delimiter must be exactly two equals signs with valid attention-style flanking. A single or triple run remains text; code spans and escapes take precedence, and nested strong/emphasis can appear inside a mark. This package does not itself relax delimiter flanking for CJK text or replace the separate CJK plugins used by engine.

Importing the plugin's types registers Mark in mdast's content maps. The resulting node is phrasing content with children, so a tree visitor should recurse rather than assume a single text child. data.hName carries the HTML element mapping; removing that data in an intervening transform changes how the next stage renders the node.

The pinned 50-case parity corpus compares positional mdast and hast with [email protected]. It covers this plugin's standalone behavior; interactions with additional attention extensions such as GFM are not implied by that parity claim. Test your complete plugin combination if you depend on a particular nesting rule.

For repository work, run pnpm --filter @ai-markdown/remark-mark-highlight test and the package build. When changing syntax or serialization, include both a parsed-tree example and a round-trip example: escaping every phrasing equals sign is an existing serializer contract, even where the source is not a highlight span. This package has independent semver, so its behavior changes are not automatically governed by the React adapter's version number.

License

MIT. Derived from the MIT-licensed remark-mark-highlight and micromark-extension-highlight-mark / mdast-util-highlight-mark; see LICENSE for attribution.