@astrojs/markdown-remark 0.11.3 → 0.11.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.
@@ -0,0 +1,5 @@
1
+ @astrojs/markdown-remark:build: cache hit, replaying output 11f745aa911f62c3
2
+ @astrojs/markdown-remark:build: 
3
+ @astrojs/markdown-remark:build: > @astrojs/markdown-remark@0.11.4 build /home/runner/work/astro/astro/packages/markdown/remark
4
+ @astrojs/markdown-remark:build: > astro-scripts build "src/**/*.ts" && tsc -p tsconfig.json
5
+ @astrojs/markdown-remark:build: 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @astrojs/markdown-remark
2
2
 
3
+ ## 0.11.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`1cc5b7890`](https://github.com/withastro/astro/commit/1cc5b78905633608e5b07ad291f916f54e67feb1)]:
8
+ - @astrojs/prism@0.5.0
9
+
3
10
  ## 0.11.3
4
11
 
5
12
  ### Patch Changes
package/dist/index.js CHANGED
@@ -41,8 +41,8 @@ async function renderMarkdown(content, opts = {}) {
41
41
  }
42
42
  const loadedRemarkPlugins = await Promise.all(loadPlugins(remarkPlugins));
43
43
  const loadedRehypePlugins = await Promise.all(loadPlugins(rehypePlugins));
44
- loadedRemarkPlugins.forEach(([plugin, opts2]) => {
45
- parser.use([[plugin, opts2]]);
44
+ loadedRemarkPlugins.forEach(([plugin, pluginOpts]) => {
45
+ parser.use([[plugin, pluginOpts]]);
46
46
  });
47
47
  if (scopedClassName) {
48
48
  parser.use([scopedStyles(scopedClassName)]);
@@ -67,8 +67,8 @@ async function renderMarkdown(content, opts = {}) {
67
67
  }
68
68
  ]
69
69
  ]);
70
- loadedRehypePlugins.forEach(([plugin, opts2]) => {
71
- parser.use([[plugin, opts2]]);
70
+ loadedRehypePlugins.forEach(([plugin, pluginOpts]) => {
71
+ parser.use([[plugin, pluginOpts]]);
72
72
  });
73
73
  parser.use(isMDX ? [rehypeJsx, rehypeExpressions] : [rehypeRaw]).use(rehypeEscape).use(rehypeIslands).use([rehypeCollectHeaders]).use(rehypeStringify, { allowDangerousHtml: true });
74
74
  let result;
@@ -18,7 +18,7 @@ function createCollectHeaders() {
18
18
  const depth = Number.parseInt(level);
19
19
  let text = "";
20
20
  let isJSX = false;
21
- visit(node, (child, _2, parent) => {
21
+ visit(node, (child, __, parent) => {
22
22
  if (child.type === "element" || parent == null) {
23
23
  return;
24
24
  }
@@ -1,28 +1,9 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
1
  import { map } from "unist-util-map";
21
2
  function rehypeExpressions() {
22
3
  return function(node) {
23
4
  return map(node, (child) => {
24
5
  if (child.type === "text") {
25
- return __spreadProps(__spreadValues({}, child), { type: "raw" });
6
+ return { ...child, type: "raw" };
26
7
  }
27
8
  if (child.type === "mdxTextExpression") {
28
9
  return { type: "raw", value: `{${child.value}}` };
@@ -1,22 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
1
  import { SKIP, visit as _visit } from "unist-util-visit";
21
2
  const visit = _visit;
22
3
  function rehypeIslands() {
@@ -26,10 +7,11 @@ function rehypeIslands() {
26
7
  visit(el, "text", (child, index, parent) => {
27
8
  if (child.type === "text") {
28
9
  if (parent && child.value.indexOf("<!--") > -1 && index != null) {
29
- parent.children.splice(index, 1, __spreadProps(__spreadValues({}, child), {
10
+ parent.children.splice(index, 1, {
11
+ ...child,
30
12
  type: "comment",
31
13
  value: child.value.replace("<!--", "").replace("-->", "").trim()
32
- }));
14
+ });
33
15
  return [SKIP, index];
34
16
  }
35
17
  child.value = child.value.replace(/\n+/g, "");
@@ -9,9 +9,9 @@ function runHighlighter(lang, code) {
9
9
  if (lang == null) {
10
10
  lang = "plaintext";
11
11
  }
12
- const ensureLoaded = (lang2) => {
13
- if (lang2 && !Prism.languages[lang2]) {
14
- loadLanguages([lang2]);
12
+ const ensureLoaded = (language) => {
13
+ if (language && !Prism.languages[language]) {
14
+ loadLanguages([language]);
15
15
  }
16
16
  };
17
17
  if (languageMap.has(lang)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/markdown-remark",
3
- "version": "0.11.3",
3
+ "version": "0.11.4",
4
4
  "type": "module",
5
5
  "author": "withastro",
6
6
  "license": "MIT",
@@ -18,12 +18,12 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@astrojs/micromark-extension-mdx-jsx": "^1.0.3",
21
- "@astrojs/prism": "^0.4.1",
21
+ "@astrojs/prism": "^0.5.0",
22
22
  "acorn": "^8.7.1",
23
23
  "acorn-jsx": "^5.3.2",
24
24
  "assert": "^2.0.0",
25
25
  "github-slugger": "^1.4.0",
26
- "mdast-util-mdx-expression": "^1.2.0",
26
+ "mdast-util-mdx-expression": "^1.2.1",
27
27
  "mdast-util-mdx-jsx": "^1.2.0",
28
28
  "mdast-util-to-string": "^3.1.0",
29
29
  "micromark-extension-mdx-expression": "^1.0.3",
@@ -50,7 +50,7 @@
50
50
  "@types/mocha": "^9.1.1",
51
51
  "@types/prismjs": "^1.26.0",
52
52
  "@types/unist": "^2.0.6",
53
- "astro-scripts": "0.0.4",
53
+ "astro-scripts": "0.0.6",
54
54
  "chai": "^4.3.6",
55
55
  "micromark-util-types": "^1.0.2",
56
56
  "mocha": "^9.2.2"
package/src/index.ts CHANGED
@@ -57,8 +57,8 @@ export async function renderMarkdown(
57
57
  const loadedRemarkPlugins = await Promise.all(loadPlugins(remarkPlugins));
58
58
  const loadedRehypePlugins = await Promise.all(loadPlugins(rehypePlugins));
59
59
 
60
- loadedRemarkPlugins.forEach(([plugin, opts]) => {
61
- parser.use([[plugin, opts]]);
60
+ loadedRemarkPlugins.forEach(([plugin, pluginOpts]) => {
61
+ parser.use([[plugin, pluginOpts]]);
62
62
  });
63
63
 
64
64
  if (scopedClassName) {
@@ -87,8 +87,8 @@ export async function renderMarkdown(
87
87
  ],
88
88
  ]);
89
89
 
90
- loadedRehypePlugins.forEach(([plugin, opts]) => {
91
- parser.use([[plugin, opts]]);
90
+ loadedRehypePlugins.forEach(([plugin, pluginOpts]) => {
91
+ parser.use([[plugin, pluginOpts]]);
92
92
  });
93
93
 
94
94
  parser
@@ -106,6 +106,7 @@ export async function renderMarkdown(
106
106
  // Ensure that the error message contains the input filename
107
107
  // to make it easier for the user to fix the issue
108
108
  err = prefixError(err, `Failed to parse Markdown file "${input.path}"`);
109
+ // eslint-disable-next-line no-console
109
110
  console.error(err);
110
111
  throw err;
111
112
  }
@@ -20,7 +20,7 @@ export default function createCollectHeaders() {
20
20
 
21
21
  let text = '';
22
22
  let isJSX = false;
23
- visit(node, (child, _, parent) => {
23
+ visit(node, (child, __, parent) => {
24
24
  if (child.type === 'element' || parent == null) {
25
25
  return;
26
26
  }
@@ -13,9 +13,9 @@ function runHighlighter(lang: string, code: string) {
13
13
  lang = 'plaintext';
14
14
  }
15
15
 
16
- const ensureLoaded = (lang: string) => {
17
- if (lang && !Prism.languages[lang]) {
18
- loadLanguages([lang]);
16
+ const ensureLoaded = (language: string) => {
17
+ if (language && !Prism.languages[language]) {
18
+ loadLanguages([language]);
19
19
  }
20
20
  };
21
21
 
@@ -30,6 +30,7 @@ function runHighlighter(lang: string, code: string) {
30
30
  }
31
31
 
32
32
  if (lang && !Prism.languages[lang]) {
33
+ // eslint-disable-next-line no-console
33
34
  console.warn(`Unable to load the language: ${lang}`);
34
35
  }
35
36