@rspress-theme-anatole/plugin-container-syntax 0.0.2 → 0.0.4

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/container.css CHANGED
@@ -129,6 +129,28 @@
129
129
  color: var(--rp-container-tip-text);
130
130
  }
131
131
 
132
+
133
+
134
+
135
+ .rspress-doc .rspress-directive.tabs {
136
+ border-color: var(--rp-container-tip-border);
137
+ background-color: var(--rp-container-tip-bg);
138
+ }
139
+
140
+ .rspress-doc .rspress-directive.tabs .rspress-directive-title {
141
+ color: var(--rp-container-tip-text);
142
+ }
143
+
144
+ .rspress-doc .rspress-directive.tabs code {
145
+ color: var(--rp-container-tip-text);
146
+ background-color: var(--rp-container-tip-code-bg);
147
+ }
148
+
149
+ .rspress-doc .rspress-directive.tabs a {
150
+ color: var(--rp-container-tip-text);
151
+ }
152
+
153
+
132
154
  .rspress-doc .rspress-directive.info {
133
155
  border-color: var(--rp-container-info-border);
134
156
  background-color: var(--rp-container-info-bg);
@@ -203,4 +225,4 @@
203
225
 
204
226
  .rspress-doc .rspress-directive.details a {
205
227
  color: var(--rp-container-details-link);
206
- }
228
+ }
package/dist/index.js CHANGED
@@ -2,25 +2,19 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
2
2
  import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
3
3
  import * as __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__ from "@rspress-theme-anatole/shared";
4
4
  const DIRECTIVE_TYPES = [
5
- 'tip',
6
- 'note',
7
- 'warning',
8
- 'caution',
9
- 'danger',
10
- 'info',
11
- 'details'
5
+ 'tabs',
12
6
  ];
13
7
  const REGEX_BEGIN = /^\s*:::\s*(\w+)\s*(.*)?/;
14
8
  const REGEX_END = /\s*:::$/;
15
9
  const REGEX_GH_BEGIN = /^\s*\s*\[!(\w+)\]\s*(.*)?/;
16
10
  const TITLE_REGEX_IN_MD = /{\s*title=["']?(.+)}\s*/;
17
11
  const TITLE_REGEX_IN_MDX = /\s*title=["']?(.+)\s*/;
18
- const trimTailingQuote = (str)=>str.replace(/['"]$/g, '');
19
- const parseTitle = (rawTitle = '', isMDX = false)=>{
12
+ const trimTailingQuote = (str) => str.replace(/['"]$/g, '');
13
+ const parseTitle = (rawTitle = '', isMDX = false) => {
20
14
  const matched = rawTitle?.match(isMDX ? TITLE_REGEX_IN_MDX : TITLE_REGEX_IN_MD);
21
15
  return trimTailingQuote(matched?.[1] || rawTitle);
22
16
  };
23
- const createContainer = (type, title, children)=>{
17
+ const createContainer = (type, title, children) => {
24
18
  const isDetails = 'details' === type;
25
19
  const rootHName = isDetails ? 'details' : 'div';
26
20
  const titleHName = isDetails ? 'summary' : 'div';
@@ -64,7 +58,7 @@ const createContainer = (type, title, children)=>{
64
58
  function transformer(tree) {
65
59
  let i = 0;
66
60
  try {
67
- while(i < tree.children.length){
61
+ while (i < tree.children.length) {
68
62
  const node = tree.children[i];
69
63
  if ('children' in node) transformer(node);
70
64
  if ('containerDirective' === node.type) {
@@ -157,7 +151,7 @@ function transformer(tree) {
157
151
  }
158
152
  if (lastChildInNode !== firstTextNode && wrappedChildren.length) wrappedChildren[0].children.push(lastChildInNode);
159
153
  let j = i + 1;
160
- while(j < tree.children.length){
154
+ while (j < tree.children.length) {
161
155
  const currentParagraph = tree.children[j];
162
156
  if ('paragraph' !== currentParagraph.type) {
163
157
  wrappedChildren.push(currentParagraph);
@@ -168,7 +162,7 @@ function transformer(tree) {
168
162
  if (lastChild === firstTextNode || 'text' === lastChild.type && REGEX_END.test(lastChild.value)) {
169
163
  const lastChildText = lastChild.value;
170
164
  const matchedEndContent = lastChildText.slice(0, -3).trim();
171
- wrappedChildren.push(...currentParagraph.children.filter((child)=>child !== firstTextNode && child !== lastChild));
165
+ wrappedChildren.push(...currentParagraph.children.filter((child) => child !== firstTextNode && child !== lastChild));
172
166
  if (matchedEndContent) wrappedChildren.push({
173
167
  type: 'paragraph',
174
168
  children: [
@@ -184,7 +178,7 @@ function transformer(tree) {
184
178
  }
185
179
  wrappedChildren.push({
186
180
  ...currentParagraph,
187
- children: currentParagraph.children.filter((child)=>child !== firstTextNode)
181
+ children: currentParagraph.children.filter((child) => child !== firstTextNode)
188
182
  });
189
183
  j++;
190
184
  }
@@ -196,7 +190,7 @@ function transformer(tree) {
196
190
  throw e;
197
191
  }
198
192
  }
199
- const remarkPluginContainer = ()=>transformer;
193
+ const remarkPluginContainer = () => transformer;
200
194
  const src_dirname = (0, __WEBPACK_EXTERNAL_MODULE__rspress_shared_baa012d0__.normalizePosixPath)(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].dirname((0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.fileURLToPath)(import.meta.url)));
201
195
  function pluginContainerSyntax() {
202
196
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress-theme-anatole/plugin-container-syntax",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "license": "MIT",
5
5
  "sideEffects": [
6
6
  "*.css",