From 6457e859a883bc446c4cd428b18ccc715bf92d34 Mon Sep 17 00:00:00 2001 From: Luma Date: Sun, 4 Feb 2024 18:48:44 +0900 Subject: [PATCH] patch: fix to drop C elements --- examples/render/output/counter.mdx.js | 17 +---------------- src/rehype-counter.ts | 3 ++- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/examples/render/output/counter.mdx.js b/examples/render/output/counter.mdx.js index c83252d..29cfec3 100644 --- a/examples/render/output/counter.mdx.js +++ b/examples/render/output/counter.mdx.js @@ -10,8 +10,7 @@ function _createMdxContent(props) { p: "p", ...props.components, }, - { C, LumaCounter, LumaMdxLayout, LumaToc } = _components; - if (!C) _missingMdxReference("C", true); + { LumaCounter, LumaMdxLayout, LumaToc } = _components; if (!LumaCounter) _missingMdxReference("LumaCounter", true); if (!LumaMdxLayout) _missingMdxReference("LumaMdxLayout", true); if (!LumaToc) _missingMdxReference("LumaToc", true); @@ -66,10 +65,6 @@ function _createMdxContent(props) { }), void (globalThis[_rehypeKatexContext0] = ""), "\n", - _jsx(C, { - $foo: true, - template: "%1(/%n): ", - }), "\n", _jsxs(_components.h1, { slug: "用意する", @@ -120,9 +115,6 @@ function _createMdxContent(props) { ], }), "\n", - _jsx(C, { - template: "%0.", - }), "\n", _jsxs(_components.p, { children: [ @@ -147,10 +139,6 @@ function _createMdxContent(props) { ], }), "\n", - _jsx(C, { - template: "[重要] %0.", - keep: true, - }), "\n", _jsxs(_components.p, { children: [ @@ -171,9 +159,6 @@ function _createMdxContent(props) { ], }), "\n", - _jsx(C, { - template: "%0.", - }), "\n", _jsx(_components.p, { children: "片付け編:", diff --git a/src/rehype-counter.ts b/src/rehype-counter.ts index 844c335..efbaa48 100644 --- a/src/rehype-counter.ts +++ b/src/rehype-counter.ts @@ -1,5 +1,5 @@ import { MdxJsxFlowElementHast } from "mdast-util-mdx-jsx"; -import { visit } from "./util/visit.js"; +import { DELETE, visit } from "./util/visit.js"; import { getAttrByName } from "./util/util-mdast.js"; import { estreeJsonParseOf } from "./util/estree-json-parse-of.js"; import { lumaCounter } from "./luma-counter/micromark-extension.js"; @@ -70,6 +70,7 @@ const rehypeCounter: RehypeCounterPlugin = function () { resetCounter(name); count.set(name, 0); } + return DELETE; } else if ( node.type === "mdxJsxFlowElement" && node.name === "_luma_internal_counter"