{"_id":"@ai-react-markdown/remark-mark-highlight","_rev":"3-be9a73168737c601a2d92ec8c4a9912a","name":"@ai-react-markdown/remark-mark-highlight","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@ai-react-markdown/remark-mark-highlight","version":"1.0.0","keywords":["remark","remark-plugin","remark-mark-highlight","micromark","micromark-extension","mdast","unified","markdown","mark","highlight"],"author":{"url":"https://github.com/AIEPhoenix","name":"Brian Lee","email":"aiephoenixbl@gmail.com"},"license":"MIT","_id":"@ai-react-markdown/remark-mark-highlight@1.0.0","maintainers":[{"name":"aiephoenix","email":"aiephoenixbl@gmail.com"}],"homepage":"https://github.com/AIEPhoenix/ai-react-markdown/tree/main/packages/remark-mark-highlight#readme","bugs":{"url":"https://github.com/AIEPhoenix/ai-react-markdown/issues"},"dist":{"shasum":"bf8beb832e740fb9bc0ab1a5518ca244a5accc14","tarball":"https://registry.npmjs.org/@ai-react-markdown/remark-mark-highlight/-/remark-mark-highlight-1.0.0.tgz","fileCount":9,"integrity":"sha512-j/m0uJH+Ipm+gA93Vy2pWv+81X2rOpGHYZRJYDbbpQYnlUtwUkniOYszdm8YRvHyMr+vmMjbqYNjB9Jnv1qYrQ==","signatures":[{"sig":"MEYCIQD8IPAAuaiMC6jToL7jfmtfCs/+MfSMGvmen96xa8gCdwIhAPYfIwzBNoAaXUAEsHnkB/TqN+u9ldsfm6MIVFsjgAs8","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":55234},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":{"import":"./dist/index.d.ts","require":"./dist/index.d.cts"},"import":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"gitHead":"14fd466fd447818e037fd155aedf4c5bd6794d74","scripts":{"test":"vitest --run","build":"node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsup","typecheck":"tsc --noEmit -p tsconfig.json","prepublishOnly":"pnpm build"},"_npmUser":{"name":"aiephoenix","email":"aiephoenixbl@gmail.com"},"repository":{"url":"git+https://github.com/AIEPhoenix/ai-react-markdown.git","type":"git","directory":"packages/remark-mark-highlight"},"_npmVersion":"11.16.0","description":"remark plugin for ==mark== highlight syntax — first-party successor to remark-mark-highlight, with dual ESM/CJS output.","directories":{},"sideEffects":false,"_nodeVersion":"24.18.0","dependencies":{"unified":"^11.0.5","@types/mdast":"^4.0.4","micromark-util-types":"^2.0.2","micromark-util-symbol":"^2.0.1","mdast-util-to-markdown":"^2.1.2","micromark-util-chunked":"^2.0.1","mdast-util-from-markdown":"^2.0.2","micromark-util-resolve-all":"^2.0.1","micromark-util-classify-character":"^2.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^25.9.5","remark-parse":"^11.0.0","remark-stringify":"^11.0.0","mdast-util-to-hast":"^13.2.1"},"_npmOperationalInternal":{"tmp":"tmp/remark-mark-highlight_1.0.0_1785750559283_0.9463195671317013","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Moved to @ai-markdown/remark-mark-highlight. Migration guide: https://github.com/ai-markdown/ai-markdown/blob/main/docs/framework-transition.md"},"1.0.1":{"name":"@ai-react-markdown/remark-mark-highlight","version":"1.0.1","keywords":["remark","remark-plugin","remark-mark-highlight","micromark","micromark-extension","mdast","mdast-util","unified","markdown","mark","highlight","==mark==","typescript"],"author":"Brian Lee <aiephoenixbl@gmail.com> (https://github.com/AIEPhoenix)","license":"MIT","_id":"@ai-react-markdown/remark-mark-highlight@1.0.1","maintainers":[{"name":"aiephoenix","email":"aiephoenixbl@gmail.com"}],"homepage":"https://github.com/AIEPhoenix/ai-react-markdown/tree/main/packages/remark-mark-highlight#readme","bugs":{"url":"https://github.com/AIEPhoenix/ai-react-markdown/issues"},"dist":{"shasum":"9b3e45a89b130b813e53a2ad3f42111b5ec858cf","tarball":"https://registry.npmjs.org/@ai-react-markdown/remark-mark-highlight/-/remark-mark-highlight-1.0.1.tgz","fileCount":9,"integrity":"sha512-LYLxzi9lEVOMh0qrq2IwOblPhlPXSGR0joPxG4/VpVLh0hQ+CtuxUSIQmJBK7wOy+50VO9omkaepxZIooFp28w==","signatures":[{"sig":"MEUCIGbZkoR41iUz1kj0MYOdMtEuRZhYebNbgg7qhrFUyyZHAiEAiQzSnSqhefu5iU87bN2iIWPib7bvK5WodTuPXkVOSjk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ai-react-markdown%2fremark-mark-highlight@1.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":63120},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"types":{"import":"./dist/index.d.ts","require":"./dist/index.d.cts"},"import":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"scripts":{"test":"vitest --run","build":"node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsup && node scripts/assert-dist-clean.mjs","typecheck":"tsc --noEmit -p tsconfig.json"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:57bae23e-7b4e-4615-b16f-e974679d63a3"}},"repository":{"url":"git+https://github.com/AIEPhoenix/ai-react-markdown.git","type":"git","directory":"packages/remark-mark-highlight"},"description":"remark plugin for ==mark== highlight syntax — first-party successor to remark-mark-highlight, with dual ESM/CJS output.","directories":{},"sideEffects":false,"_nodeVersion":"26.0.0","dependencies":{"unified":"^11.0.5","@types/mdast":"^4.0.4","micromark-util-types":"^2.0.2","micromark-util-symbol":"^2.0.1","mdast-util-to-markdown":"^2.1.2","micromark-util-chunked":"^2.0.1","mdast-util-from-markdown":"^2.0.2","micromark-util-resolve-all":"^2.0.1","micromark-util-classify-character":"^2.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"remark-gfm":"^4.0.1","@types/node":"^25.9.5","remark-parse":"^11.0.0","remark-stringify":"^11.0.0","mdast-util-to-hast":"^13.2.1"},"_npmOperationalInternal":{"tmp":"tmp/remark-mark-highlight_1.0.1_1788844115193_0.3111921740534884","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Moved to @ai-markdown/remark-mark-highlight. Migration guide: https://github.com/ai-markdown/ai-markdown/blob/main/docs/framework-transition.md"}},"time":{"created":"2026-08-03T09:49:19.168Z","modified":"2026-09-11T00:48:04.662Z","1.0.0":"2026-08-03T09:49:19.453Z","1.0.1":"2026-09-08T05:08:35.340Z"},"bugs":{"url":"https://github.com/AIEPhoenix/ai-react-markdown/issues"},"author":"Brian Lee <aiephoenixbl@gmail.com> (https://github.com/AIEPhoenix)","license":"MIT","homepage":"https://github.com/AIEPhoenix/ai-react-markdown/tree/main/packages/remark-mark-highlight#readme","keywords":["remark","remark-plugin","remark-mark-highlight","micromark","micromark-extension","mdast","mdast-util","unified","markdown","mark","highlight","==mark==","typescript"],"repository":{"url":"git+https://github.com/AIEPhoenix/ai-react-markdown.git","type":"git","directory":"packages/remark-mark-highlight"},"description":"remark plugin for ==mark== highlight syntax — first-party successor to remark-mark-highlight, with dual ESM/CJS output.","maintainers":[{"name":"aiephoenix","email":"aiephoenixbl@gmail.com"}],"readme":"# @ai-react-markdown/remark-mark-highlight\n\n[![npm version](https://img.shields.io/npm/v/@ai-react-markdown/remark-mark-highlight?logo=npm&color=cb3837)](https://www.npmjs.com/package/@ai-react-markdown/remark-mark-highlight)\n[![npm downloads](https://img.shields.io/npm/dm/@ai-react-markdown/remark-mark-highlight?color=blue)](https://www.npmjs.com/package/@ai-react-markdown/remark-mark-highlight)\n[![minzipped size](https://img.shields.io/bundlephobia/minzip/@ai-react-markdown/remark-mark-highlight?label=minzip)](https://bundlephobia.com/package/@ai-react-markdown/remark-mark-highlight)\n[![types](https://img.shields.io/npm/types/@ai-react-markdown/remark-mark-highlight?logo=typescript&logoColor=white&color=3178c6)](https://www.typescriptlang.org/)\n\n[![Node ≥20](https://img.shields.io/badge/Node-%E2%89%A520-339933?logo=nodedotjs&logoColor=white)](https://nodejs.org/)\n[![ESM + CJS](https://img.shields.io/badge/module-ESM%20%2B%20CJS-f7df1e?logo=javascript&logoColor=black)](#install)\n[![remark plugin](https://img.shields.io/badge/remark-plugin-2c1e60?logo=markdown&logoColor=white)](https://github.com/remarkjs/remark)\n[![license](https://img.shields.io/npm/l/@ai-react-markdown/remark-mark-highlight?color=green)](https://github.com/AIEPhoenix/ai-react-markdown/blob/main/packages/remark-mark-highlight/LICENSE)\n\n[![CI](https://img.shields.io/github/actions/workflow/status/AIEPhoenix/ai-react-markdown/ci.yml?branch=main&label=CI&logo=githubactions&logoColor=white)](https://github.com/AIEPhoenix/ai-react-markdown/actions/workflows/ci.yml)\n[![Release](https://img.shields.io/github/actions/workflow/status/AIEPhoenix/ai-react-markdown/release.yml?label=release&logo=githubactions&logoColor=white)](https://github.com/AIEPhoenix/ai-react-markdown/actions/workflows/release.yml)\n[![part of ai-react-markdown](https://img.shields.io/badge/monorepo-ai--react--markdown-8a2be2?logo=github)](https://github.com/AIEPhoenix/ai-react-markdown)\n\nA [remark](https://github.com/remarkjs/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.\n\nUse 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. The core renderer already enables this capability through its sealed `highlight` plugin, so core users do not need to register this package separately.\n\nFirst-party continuation of the unmaintained [`remark-mark-highlight`](https://www.npmjs.com/package/remark-mark-highlight), used internally by [`@ai-react-markdown/core`](https://github.com/AIEPhoenix/ai-react-markdown/blob/main/packages/core)'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.\n\n## Install\n\n```bash\nnpm install @ai-react-markdown/remark-mark-highlight\n```\n\nDual ESM/CJS build: both `import` and `require` work, types included for both.\n\n## Use\n\nA parse-only processor produces an mdast tree. Call `parse` and `run` rather than `process`, since there is no compiler in this first pipeline:\n\n```ts\nimport { unified } from 'unified';\nimport remarkParse from 'remark-parse';\nimport { remarkMarkHighlight } from '@ai-react-markdown/remark-mark-highlight';\n\nconst processor = unified().use(remarkParse).use(remarkMarkHighlight);\nconst tree = processor.runSync(processor.parse('==hi=='));\n// tree contains: { type: 'mark', data: { hName: 'mark' }, children: [...] }\n```\n\nTo render HTML, add the conversion and serialization stages (install their packages alongside unified and remark-parse):\n\n```ts\nimport { unified } from 'unified';\nimport remarkParse from 'remark-parse';\nimport remarkRehype from 'remark-rehype';\nimport rehypeStringify from 'rehype-stringify';\nimport { remarkMarkHighlight } from '@ai-react-markdown/remark-mark-highlight';\n\nconst html = unified()\n  .use(remarkParse)\n  .use(remarkMarkHighlight)\n  .use(remarkRehype)\n  .use(rehypeStringify)\n  .processSync('==**bold** inside==');\n\nconsole.log(String(html));\n// <p><mark><strong>bold</strong> inside</mark></p>\n```\n\nNo custom mdast-to-hast handler is required. If your full application pipeline uses rehype-sanitize, include `mark` in its allowed tags; core'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.\n\n## Syntax at a glance\n\n| Markdown                    | mdast                                                        | HTML                                        |\n| --------------------------- | ------------------------------------------------------------ | ------------------------------------------- |\n| `==text==`                  | `{ type: 'mark', children: [text] }`                         | `<mark>text</mark>`                         |\n| `==**bold** inside==`       | `mark` → `strong` → `text` (nesting follows attention rules) | `<mark><strong>bold</strong> inside</mark>` |\n| `\\==not a mark==`           | plain text                                                   | `==not a mark==`                            |\n| `` `==code==` ``            | `inlineCode` (code spans win)                                | `<code>==code==</code>`                     |\n| `=single=` / `===triple===` | plain text (exactly two `=` open/close)                      | unchanged                                   |\n\nWorks 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-react-markdown/core` default schema already does).\n\n## Compatibility\n\n|                  |                                                                                                                                         |\n| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------- |\n| unified / remark | remark 15+ (micromark 4, mdast-util-from-markdown 2, mdast-util-to-markdown 2)                                                          |\n| Node             | ≥ 20                                                                                                                                    |\n| 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 |\n| Types            | `Mark` is registered in mdast's `PhrasingContentMap` and `RootContentMap`, so `mark` nodes type-check inside paragraphs                 |\n\n## Behavior contract\n\n- 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.\n- **Byte-compatible with `remark-mark-highlight@0.1.1`**: 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.\n\n## Footguns\n\n- **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.\n\n## API\n\n| Export                                                  | What                                                                                   |\n| ------------------------------------------------------- | -------------------------------------------------------------------------------------- |\n| `remarkMarkHighlight`                                   | The remark plugin (also aliased as `remarkMark`, the upstream's export name)           |\n| `markHighlight()`                                       | The raw micromark extension                                                            |\n| `markHighlightFromMarkdown` / `markHighlightToMarkdown` | The mdast from/to-markdown extensions                                                  |\n| `Mark` (type)                                           | The mdast node interface (`type: 'mark'`), registered in mdast's phrasing-content maps |\n\n## Versioning\n\nThis package versions independently of the `@ai-react-markdown/core` release train — core depends on it through a normal semver range.\n\n## Integration boundaries and verification\n\nThe 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 core.\n\nImporting 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.\n\nThe pinned 50-case parity corpus compares positional mdast and hast with `remark-mark-highlight@0.1.1`. 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.\n\nFor repository work, run `pnpm --filter @ai-react-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 core's version number.\n\n## License\n\nMIT. Derived from the MIT-licensed `remark-mark-highlight` and `micromark-extension-highlight-mark` / `mdast-util-highlight-mark`; see [LICENSE](https://github.com/AIEPhoenix/ai-react-markdown/blob/main/packages/remark-mark-highlight/LICENSE) for attribution.\n","readmeFilename":""}