0.0.4 • Published 2 years ago

@mdxvac/mdx-utils v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@mdxvac/mdx-utils

DEPRECATED: Please consider using the plugin astro-m2dx, which bundles all features from the @mdxvac plugins in one plugin (completely opt-in).

Type guards for remark.

Content

What is this?

This is an NPM package providing type guards for remark types.

When should I use this?

You shouldn't, it is meant for internal use in the @mdxvac plugins, but not tested for general purpose.

Install

This package is ESM only. In Node.js (version 12.20+, 14.14+, or 16.0+), install with npm:

npm install -D @mdxvac/mdx-utils

Use

import { isHeading } from '@mdxvac/mdx-utils';

if (isHeading(node)) {
  // This is type-safe now
  if (node.depth > 2) {
    ...
  }
}