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

@edv4h/usketch-plugin-markdown-to-shape

v0.2.0

Published

Markdown を**複数の native shape に分解**する uSketch プラグイン。「どの Markdown 構造をどの shape にするか」は**変換レジストリに登録**する方式(IoC)で、このプラグインは具体的な shape に一切依存しない。

Readme

@edv4h/usketch-plugin-markdown-to-shape

Markdown を複数の native shape に分解する uSketch プラグイン。「どの Markdown 構造をどの shape にするか」は変換レジストリに登録する方式(IoC)で、このプラグインは具体的な shape に一切依存しない。

仕組み

  1. ctx.markdownConverters@edv4h/usketch-core が提供、PluginContext 経由)に converter を登録する:
    ctx.markdownConverters.register({
      id: "app:heading-to-text",
      nodeTypes: ["heading"],        // mdast のノード種別
      order: 0,                       // 高いほど優先、同点は後勝ち
      convert: (node, cctx) => [{ type: "text", text: /* ... */, fontSize: 28 }],
    });
  2. Control HUD の Action 「🧩 Markdown を図形に分解」(markdown shape を単一選択時のみ有効)を実行すると:
    • remark-parse + remark-gfm で source を mdast に parse。
    • top-level ブロックごとに登録 converter を解決(nodeTypes/matchorder 最大 → 後勝ち)。
    • 未登録のブロックは markdown shape にフォールバック(生ソースを slice して保持するので、表・コード・mermaid もそのまま整形描画される)。
    • 生成 shape を縦フローで配置し、元 markdown shape を置き換える(1 操作で undo 可能)。

依存の向き(デカップリング)

  • このプラグインは @edv4h/usketch-shared のみに依存し、text / table などの shape プラグインを import しない
  • 変換先は「登録する側」が持つ(例: apps/web の adapter が heading→text を登録)。将来 code/table 等の native shape を足すときも converter を登録するだけで、本体は無改変。
  • フォールバックの markdown shape は型文字列だけで生成するため、markdown-shape プラグインへのコード依存も無い。

Mermaid フローチャートの分解

mermaidgraph / flowchart(TD/LR 等)を、rectangle + text ノードconnector の編集可能な図に分解する converter を同梱(createMermaidFlowchartConverter)。app 側 adapter で登録して使う。

  • 自前パーサ + @dagrejs/dagre レイアウト(同期 なので converter は同期のまま)。
  • ctx.origin を起点に絶対配置。connector は node の id で接続するので、ノードを動かすと線も追従。
  • 非 flowchart の mermaid(sequence / gantt 等)や解析失敗は markdown shape にフォールバック(図としてそのまま描画)。
  • サブグラフ・スタイル定義・複雑なエッジ種別は v1 では簡略化。

「1 ブロック → 相互接続されたサブグラフ」を返せるよう、MarkdownShapeSpecid/x/y を、MarkdownConverterContextorigin を持つ。単発 spec(見出し等)はこれらを省略でき、orchestrator が縦フロー枠に配置する。

エクスポート

  • createMarkdownToShapePlugin() — プラグイン本体。
  • createMermaidFlowchartConverter() — mermaid flowchart → 図分解 converter(app が登録)。
  • parseFlowchart(code) — mermaid flowchart 構文パーサ(純粋関数)。
  • convertMarkdownToShapes(opts) — source → 配置済み ShapeData[](オーケストレータ)。
  • parseMarkdown / topLevelBlocks / mdastText / nodeSource — converter 実装用の mdast ヘルパ。

非スコープ / 今後

  • 高さは v1 では推定(描画前は未確定)。measure ベース精緻化は後段。
  • code / table の native shape が無いため当面は markdown フォールバック(設計どおり)。
  • 段落内インライン装飾の分解は行わない(段落 = 1 text)。