@astrojs/markdown-remark 5.2.0 → 6.0.0-alpha.0

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/dist/highlight.js CHANGED
@@ -16,13 +16,13 @@ async function highlightCodeBlocks(tree, highlighter) {
16
16
  let languageMatch;
17
17
  let { className } = node.properties;
18
18
  if (typeof className === "string") {
19
- languageMatch = className.match(languagePattern);
19
+ languageMatch = languagePattern.exec(className);
20
20
  } else if (Array.isArray(className)) {
21
21
  for (const cls of className) {
22
22
  if (typeof cls !== "string") {
23
23
  continue;
24
24
  }
25
- languageMatch = cls.match(languagePattern);
25
+ languageMatch = languagePattern.exec(cls);
26
26
  if (languageMatch) {
27
27
  break;
28
28
  }
package/dist/index.js CHANGED
@@ -117,7 +117,7 @@ function prefixError(err, prefix) {
117
117
  err.message = `${prefix}:
118
118
  ${err.message}`;
119
119
  return err;
120
- } catch (error) {
120
+ } catch {
121
121
  }
122
122
  }
123
123
  const wrappedError = new Error(`${prefix}${err ? `: ${err}` : ""}`);
@@ -13,7 +13,7 @@ function rehypeHeadingIds() {
13
13
  if (node.type !== "element") return;
14
14
  const { tagName } = node;
15
15
  if (tagName[0] !== "h") return;
16
- const [, level] = tagName.match(/h([0-6])/) ?? [];
16
+ const [, level] = /h([0-6])/.exec(tagName) ?? [];
17
17
  if (!level) return;
18
18
  const depth = Number.parseInt(level);
19
19
  let text = "";
@@ -22,7 +22,7 @@ function rehypeHeadingIds() {
22
22
  return;
23
23
  }
24
24
  if (child.type === "raw") {
25
- if (child.value.match(/^\n?<.*>\n?$/)) {
25
+ if (/^\n?<.*>\n?$/.test(child.value)) {
26
26
  return;
27
27
  }
28
28
  }
package/dist/shiki.js CHANGED
@@ -3,15 +3,6 @@ import {
3
3
  getHighlighter,
4
4
  isSpecialLang
5
5
  } from "shiki";
6
- import { visit } from "unist-util-visit";
7
- const ASTRO_COLOR_REPLACEMENTS = {
8
- "--astro-code-foreground": "--astro-code-color-text",
9
- "--astro-code-background": "--astro-code-color-background"
10
- };
11
- const COLOR_REPLACEMENT_REGEX = new RegExp(
12
- `${Object.keys(ASTRO_COLOR_REPLACEMENTS).join("|")}`,
13
- "g"
14
- );
15
6
  let _cssVariablesTheme;
16
7
  const cssVariablesTheme = () => _cssVariablesTheme ?? (_cssVariablesTheme = createCssVariablesTheme({ variablePrefix: "--astro-code-" }));
17
8
  async function createShikiHighlighter({
@@ -94,19 +85,6 @@ async function createShikiHighlighter({
94
85
  if (inline) {
95
86
  return node.children[0];
96
87
  }
97
- },
98
- root(node) {
99
- if (Object.values(themes).length) {
100
- return;
101
- }
102
- const themeName = typeof theme === "string" ? theme : theme.name;
103
- if (themeName === "css-variables") {
104
- visit(node, "element", (child) => {
105
- if (child.properties?.style) {
106
- child.properties.style = replaceCssVariables(child.properties.style);
107
- }
108
- });
109
- }
110
88
  }
111
89
  },
112
90
  ...transformers
@@ -118,9 +96,6 @@ async function createShikiHighlighter({
118
96
  function normalizePropAsString(value) {
119
97
  return Array.isArray(value) ? value.join(" ") : value;
120
98
  }
121
- function replaceCssVariables(str) {
122
- return str.replace(COLOR_REPLACEMENT_REGEX, (match) => ASTRO_COLOR_REPLACEMENTS[match] || match);
123
- }
124
99
  export {
125
100
  createShikiHighlighter
126
101
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/markdown-remark",
3
- "version": "5.2.0",
3
+ "version": "6.0.0-alpha.0",
4
4
  "type": "module",
5
5
  "author": "withastro",
6
6
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "remark-parse": "^11.0.0",
38
38
  "remark-rehype": "^11.1.0",
39
39
  "remark-smartypants": "^3.0.2",
40
- "shiki": "^1.10.3",
40
+ "shiki": "^1.14.1",
41
41
  "unified": "^11.0.5",
42
42
  "unist-util-remove-position": "^5.0.0",
43
43
  "unist-util-visit": "^5.0.0",
@@ -49,7 +49,7 @@
49
49
  "@types/estree": "^1.0.5",
50
50
  "@types/hast": "^3.0.4",
51
51
  "@types/mdast": "^4.0.4",
52
- "@types/unist": "^3.0.2",
52
+ "@types/unist": "^3.0.3",
53
53
  "esbuild": "^0.21.5",
54
54
  "mdast-util-mdx-expression": "^2.0.0",
55
55
  "astro-scripts": "0.0.14"