@mirrordown/remd-tabs 0.0.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/README.md +144 -0
- package/dist/index.d.mts +2450 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +461 -0
- package/dist/index.mjs.map +1 -0
- package/dist/tabs.css +369 -0
- package/package.json +37 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## 0.1.1
|
|
5
|
+
<sub>2026-06-25</sub>
|
|
6
|
+
|
|
7
|
+
- *(patch)*
|
|
8
|
+
fix: resolve `catalog:` protocol in published dependencies
|
|
9
|
+
|
|
10
|
+
0.1.0 was published with Yarn's `catalog:` specifier left literally in
|
|
11
|
+
`dependencies`/`devDependencies`, so consumers could not install the affected
|
|
12
|
+
packages. Packages are now packed with `yarn pack` (which resolves `catalog:`
|
|
13
|
+
to the concrete version ranges from `.yarnrc.yml`) before `npm publish`.
|
|
14
|
+
|
|
15
|
+
## 0.1.0
|
|
16
|
+
|
|
17
|
+
<sub>2026-06-23</sub>
|
|
18
|
+
|
|
19
|
+
- _(minor)_
|
|
20
|
+
|
|
21
|
+
# Initial release
|
|
22
|
+
|
|
23
|
+
First public release of the `@mirrordown/markdown` suite — a collection of markdown syntax extensions for the [unified](https://unifiedjs.com/) (remark/rehype) and [markdown-it](https://github.com/markdown-it/markdown-it) ecosystems.
|
|
24
|
+
|
|
25
|
+
## Packages
|
|
26
|
+
|
|
27
|
+
**Remark/rehype plugins** (`@mirrordown/remd-*`):
|
|
28
|
+
- `abbr` — abbreviation definitions that auto-expand matching text with `<abbr>` tooltips
|
|
29
|
+
- `attrs` — `{attrs}` syntax for adding HTML attributes to markdown elements
|
|
30
|
+
- `definition-list` — `<dl>`/`<dt>`/`<dd>` syntax from PHP Markdown Extra
|
|
31
|
+
- `del` — `~~strikethrough~~` rendered as `<del>` instead of `<s>`
|
|
32
|
+
- `github-alerts` — `> [!NOTE]` callout boxes matching GitHub's alert syntax
|
|
33
|
+
- `inline-svg` — inlines local `.svg` images into the HTML output with size/occurrence/sprite controls
|
|
34
|
+
- `ins` — `++inserted text++` rendered as `<ins>`
|
|
35
|
+
- `kbd` — `[[Ctrl]]+[[C]]` syntax for `<kbd>` keyboard input elements
|
|
36
|
+
- `mark` — `==highlighted text==` rendered as `<mark>`
|
|
37
|
+
- `ruby` — DenDen-ruby syntax (`{base|reading}`) for `<ruby>`/`<rt>`/`<rp>` annotations
|
|
38
|
+
- `steps` — numbered `@N. step` syntax for procedural guides
|
|
39
|
+
- `sub` — `~subscript~` rendered as `<sub>`
|
|
40
|
+
- `sup` — `^superscript^` rendered as `<sup>`
|
|
41
|
+
- `tabs` — `% Tab` syntax for tabbed content panels
|
|
42
|
+
- `unwrap-images` — lifts block-only images out of wrapping `<p>` tags
|
|
43
|
+
|
|
44
|
+
**Markdown-it plugins** (`@mirrordown/mdit-*`): same plugin set, ported for the markdown-it pipeline.
|
|
45
|
+
|
|
46
|
+
**VSCode extensions** (`markdown-*`): each plugin wrapped as a VSCode extension that contributes its syntax to the built-in markdown preview. (Publishing to the VSCode Marketplace is wired separately and is not part of this npm release.)
|
|
47
|
+
|
|
48
|
+
## Highlights
|
|
49
|
+
- Designed to work together — `attrs` understands custom container nodes from `tabs`/`steps`/`definition-list`/`github-alerts`, and `tabs`/`steps` nest bidirectionally.
|
|
50
|
+
- Type-aware: every package ships `.d.mts` declarations and externalizes `unist`/`mdast`/`hast` types so downstream consumers see compatible types.
|
|
51
|
+
- Tested: 880 tests covering every plugin's syntax, plus cross-plugin integration tests for nested constructs (tabs-in-steps, attrs-on-defList, github-alerts-with-attrs, etc.).
|
|
52
|
+
- Documented at [github.com/mirrordown/mirrordown](https://github.com/mirrordown/mirrordown).
|
package/README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# @mirrordown/remd-tabs
|
|
2
|
+
|
|
3
|
+
> Part of [Mirrordown](https://github.com/mirrordown/mirrordown) — a suite of markdown syntax extensions for the unified and markdown-it ecosystems.
|
|
4
|
+
|
|
5
|
+
A remark/rehype (unified) plugin for the `tabs` syntax extension.
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
The `tabs` plugin converts `%`-prefixed headers and `>`-prefixed blockquote bodies into CSS-only tab groups. Tabs use hidden radio inputs for state — no JavaScript required.
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<div class="markdown-tabs" data-tabs-group="...">
|
|
13
|
+
<div class="markdown-tabs-labels">...</div>
|
|
14
|
+
<div class="markdown-tabs-panels">...</div>
|
|
15
|
+
</div>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Syntax
|
|
19
|
+
|
|
20
|
+
Write a `% Label` line followed by a `>` blockquote for each tab's content:
|
|
21
|
+
|
|
22
|
+
````markdown
|
|
23
|
+
% JavaScript
|
|
24
|
+
|
|
25
|
+
> ```js
|
|
26
|
+
> console.log("Hello, world!");
|
|
27
|
+
> ```
|
|
28
|
+
>
|
|
29
|
+
> % TypeScript
|
|
30
|
+
>
|
|
31
|
+
> ```ts
|
|
32
|
+
> const greeting: string = "Hello, world!";
|
|
33
|
+
> console.log(greeting);
|
|
34
|
+
> ```
|
|
35
|
+
>
|
|
36
|
+
> % Python
|
|
37
|
+
>
|
|
38
|
+
> ```py
|
|
39
|
+
> print("Hello, world!")
|
|
40
|
+
> ```
|
|
41
|
+
````
|
|
42
|
+
|
|
43
|
+
### Default open tab
|
|
44
|
+
|
|
45
|
+
Mark a tab with `%+` to make it open by default (the first tab is open by default otherwise):
|
|
46
|
+
|
|
47
|
+
```markdown
|
|
48
|
+
% Option A
|
|
49
|
+
|
|
50
|
+
> This tab is not selected by default.
|
|
51
|
+
> %+ Option B
|
|
52
|
+
> This tab opens by default.
|
|
53
|
+
> % Option C
|
|
54
|
+
> This tab is not selected by default.
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Nested tabs
|
|
58
|
+
|
|
59
|
+
Use `%%` for a second level of nesting inside a tab:
|
|
60
|
+
|
|
61
|
+
````markdown
|
|
62
|
+
% Frontend
|
|
63
|
+
%% React
|
|
64
|
+
|
|
65
|
+
> ```tsx
|
|
66
|
+
> export function App() {
|
|
67
|
+
> return <h1>Hello</h1>;
|
|
68
|
+
> }
|
|
69
|
+
> ```
|
|
70
|
+
>
|
|
71
|
+
> %% Vue
|
|
72
|
+
>
|
|
73
|
+
> ```vue
|
|
74
|
+
> <template><h1>Hello</h1></template>
|
|
75
|
+
> ```
|
|
76
|
+
>
|
|
77
|
+
> % Backend
|
|
78
|
+
> Node.js or any server runtime.
|
|
79
|
+
````
|
|
80
|
+
|
|
81
|
+
## Install
|
|
82
|
+
|
|
83
|
+
Install `@mirrordown/remd-tabs`. You must also pass `tabsHastHandlers` to `remarkRehype` and import the stylesheet:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
npm install @mirrordown/remd-tabs
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Unified
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { unified } from "unified";
|
|
93
|
+
import remarkParse from "remark-parse";
|
|
94
|
+
import remarkRehype from "remark-rehype";
|
|
95
|
+
import rehypeStringify from "rehype-stringify";
|
|
96
|
+
import { remarkTabs, tabsHastHandlers } from "@mirrordown/remd-tabs";
|
|
97
|
+
import "@mirrordown/remd-tabs/tabs.css";
|
|
98
|
+
|
|
99
|
+
const processor = unified()
|
|
100
|
+
.use(remarkParse)
|
|
101
|
+
.use(remarkTabs)
|
|
102
|
+
.use(remarkRehype, { handlers: tabsHastHandlers })
|
|
103
|
+
.use(rehypeStringify);
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Astro
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
// astro.config.ts
|
|
110
|
+
import { defineConfig } from "astro/config";
|
|
111
|
+
import { remarkTabs, tabsHastHandlers } from "@mirrordown/remd-tabs";
|
|
112
|
+
import "@mirrordown/remd-tabs/tabs.css";
|
|
113
|
+
|
|
114
|
+
export default defineConfig({
|
|
115
|
+
markdown: {
|
|
116
|
+
remarkPlugins: [remarkTabs],
|
|
117
|
+
remarkRehype: { handlers: tabsHastHandlers }
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### VitePress
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
// .vitepress/config.ts
|
|
126
|
+
import { defineConfig } from "vitepress";
|
|
127
|
+
import { remarkTabs, tabsHastHandlers } from "@mirrordown/remd-tabs";
|
|
128
|
+
import "@mirrordown/remd-tabs/tabs.css";
|
|
129
|
+
|
|
130
|
+
export default defineConfig({
|
|
131
|
+
markdown: {
|
|
132
|
+
remarkPlugins: [remarkTabs],
|
|
133
|
+
remarkRehype: { handlers: tabsHastHandlers }
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Documentation
|
|
139
|
+
|
|
140
|
+
Full documentation, more examples, and configuration options: [github.com/mirrordown/mirrordown](https://github.com/mirrordown/mirrordown) (dedicated docs site coming soon).
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
MIT © [Drake Costa](https://saeris.gg)
|