Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

gt-remark

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gt-remark

Remark plugin for processing MDX/Markdown by escaping HTML-sensitive characters in text nodes.

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

gt-remark

A small Remark plugin to help safely stringify MDX/Markdown by escaping HTML-sensitive characters in text nodes, while leaving code, math, MDX expressions, and front-matter untouched.

  • Escapes: {, }, &, <, >, ", ', _
  • Ignores parents: code, inlineCode, mdxFlowExpression, mdxTextExpression, mdxjsEsm, yaml, toml, math, inlineMath
  • Idempotent for & (does not double-escape existing entities)

Install

npm install gt-remark

Usage

import { unified } from 'unified';
import remarkParse from 'remark-parse';
import remarkStringify from 'remark-stringify';
import escapeHtmlInTextNodes from 'gt-remark';

const file = await unified()
  .use(remarkParse)
  .use(escapeHtmlInTextNodes)
  .use(remarkStringify)
  .process('Hello & <world> {ok}');

console.log(String(file));

API

  • escapeHtmlInTextNodes: Remark plugin with no options. Applies safe escaping to text nodes only.

License

FSL-1.1-ALv2

Keywords

remark

FAQs

Package last updated on 30 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts