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

@yugu/markdown-it-data-block

v0.0.2

Published

A plugin for markdown-it to add data block support

Readme

自定义 markdownItDataBlock 插件

如果你在做AI相关的工作,可能会用到这个插件。它可以帮助你在markdown中嵌入数据块,并且支持自定义标签和数据格式。

1. 使用方法

注意是类 fence 语法,最好输出是使用换行符包裹避免出现意外情况

  • 直接在 markdown 中使用 yugu 标签,标签的开始和结束都需要添加 yugu-startyugu-end,中间可以放置任意内容。
  • 支持自定义开始结束标签对应的tag, 例如appsubyugu-startyugu-end 中的 tag 属性值需要一致。必须使用[]包裹
  • 支持自定义数据,数据可以是字符串和 json 对象,json 对象需要转义。且数据必须用$包裹
  • 支持嵌套标签,嵌套标签必须成对,不能跨yugu-xx分开。

2. 依赖

插件依赖markdown-it-attrs,需要在 markdown-it 中注册该插件。

3. 示例

import MarkdownIt from 'markdown-it'
import markdownItAttrs from 'markdown-it-attrs'
import markdownItDataBlock from '@yuguaa/markdown-it-data-block'
const md = new MarkdownIt()
  .use(markdownItAttrs)
  .use(markdownItDataBlock)
const html = md.render(
  `::: yugu-start[app]\${"a": 1,"b":[{"c":222}]}\$
    app 块内容
    \n::: yugu-start[sub]\${"a": 1,"b":[{"c":55}]}\$
    sub 块内容
    \n::: yugu-end[sub]\$支持嵌套,但必须合并标签嵌套\$
    app 块内容结束,在app块内
    \n::: yugu-end[app]\$这里是数据,可以是字符串和json\$
    app 块内容外`
)
console.log(html)
// 注意流式情况下包裹换行符号避免意外情况
'::: yugu-start[app]${"a":1,"b":[{"c":222}]}$ \napp开始了\n # 一级标题\n::: yugu-start[sub]\n # 二级标签开始了\n::: yugu-end[sub]\n- [ ] 7:30-8:00 晨跑3公里\n- [ ] 每工作1小时起身拉伸/喝水\n\n\n # 二级标签结束了\n \n\n::: yugu-end[app]$这里是数据,可以是字符串和json$\n'