@riebeckite/plugin-shortcodes 0.0.41 → 0.0.42

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.
Files changed (2) hide show
  1. package/dist/index.js +9 -0
  2. package/package.json +6 -5
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // index.ts
2
2
  import { createStyleAsset, definePlugin } from "@riebeckite/core";
3
+ import remarkDirective from "remark-directive";
3
4
 
4
5
  // src/builtins.ts
5
6
  import { escapeHtml, escapeHtmlAttribute } from "@riebeckite/core";
@@ -418,6 +419,13 @@ function transformDirective(target, resolved, options, file) {
418
419
  const { label, children } = extractLabel(node);
419
420
  const attributes = normalizeAttributes(node, file);
420
421
  const childrenHtml = container ? SHORTCODE_CHILDREN_MARKER : void 0;
422
+ if (inline && !isDirectiveNameStart(name)) {
423
+ parent.children.splice(index, 1, {
424
+ type: "text",
425
+ value: sourceText(name, label, attributes, false, true)
426
+ });
427
+ return;
428
+ }
421
429
  if (inline && !isInlineShortcode(name, resolved)) {
422
430
  const known = Object.hasOwn(resolved.shortcodes, name);
423
431
  report(
@@ -611,6 +619,7 @@ function shortcodes(options = {}) {
611
619
  },
612
620
  options,
613
621
  extendMarkdownPipeline: (pipeline, context) => {
622
+ pipeline.use(remarkDirective);
614
623
  pipeline.use(remarkShortcodes, {
615
624
  ...options,
616
625
  contentIndex: context.contentIndex,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/plugin-shortcodes",
3
- "version": "0.0.41",
3
+ "version": "0.0.42",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -15,13 +15,14 @@
15
15
  "./style.css": "./style.css"
16
16
  },
17
17
  "dependencies": {
18
- "@riebeckite/core": "0.0.41",
19
18
  "@types/mdast": "^4.0.4",
20
- "unist-util-visit": "^5.1.0"
19
+ "remark-directive": "^4.0.0",
20
+ "unist-util-visit": "^5.1.0",
21
+ "@riebeckite/core": "0.0.42"
21
22
  },
22
23
  "devDependencies": {
23
- "@riebeckite/test": "0.0.41",
24
- "tsx": "^4.22.4"
24
+ "tsx": "^4.22.4",
25
+ "@riebeckite/test": "0.0.42"
25
26
  },
26
27
  "publishConfig": {
27
28
  "access": "public"