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

remark-block-directive

v0.4.1

Published

Remark plugin for turning HTML directive into MDX tags

Readme

remark-block-directive

Remark plugin for turning HTML directive into MDX tags.

npm github node

Example

Turn:

---
blockBreak: true
---

::::div{.abc}

xyz

:::p

foo

---

bar

:::

::::

Into:

<div class="abc">
  xyz
  <p>foo</p>
  <p>bar</p>
</div>

Page Break

pageBreakroot 级别(容器指令外部)的 --- 分割线作为分页依据, 把每段内容包裹进 div{.<class>}(类名即 pageBreak 的取值,如 a4)。

---
pageBreak: a4
---

A

---

B

转为:

<div class="a4">A</div>

<div class="a4">B</div>

pageBreakblockBreak 相互独立、可并存:

  • blockBreak: true 作用于容器指令内部---
  • pageBreak: <class> 作用于 root 级别(容器外部)的 ---
---
blockBreak: true
pageBreak: a4
---

:::div

A

---

B

::::

---

X

:::div 内部按 blockBreak 拆成两个 div,root 级别的 --- 再按 pageBreak 将整体拆成两个 div.a4

仅当文档中存在 root 级 --- 时才包裹,重复处理结果为幂等(分割线在首次处理即被消耗)。

Tips

Only some HTML tags are supported.

Installation

npm install remark-block-directive --save-dev

Usage

import readFileSync from 'node:fs';

import { remark } from 'remark';
import { remarkBlockDirective } from 'remark-block-directive';
import remarkDirective from 'remark-directive';
import remarkFrontmatter from 'remark-frontmatter';
import remarkMdx from 'remark-mdx';
import remarkRehype from 'remark-rehype';
import rehypeRaw from 'rehype-raw';
import rehypeStringify from 'rehype-stringify';

const markdownText = readFileSync('example.md', 'utf8');

// MDX mode
remark()
  .use(remarkFrontmatter, ['yaml'])
  .use(remarkMdx)
  .use(remarkDirective)
  .use(remarkBlockDirective, { mode: 'mdx' })
  .process(markdownText)
  .then((file) => console.info(file))
  .catch((error) => console.warn(error));

// HTML mode
remark()
  .use(remarkFrontmatter, ['yaml'])
  .use(remarkDirective)
  .use(remarkBlockDirective, { mode: 'html' })
  .use(remarkRehype, { allowDangerousHtml: true })
  .use(rehypeRaw)
  .use(rehypeStringify)
  .process(markdownText)
  .then((file) => console.info(file))
  .catch((error) => console.warn(error));

Related