@astrojs/markdown-remark 0.11.4 → 0.11.7

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.
@@ -1,5 +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: 
1
+ @astrojs/markdown-remark:build: cache hit, replaying output b4050b97e1fd3558
2
+ @astrojs/markdown-remark:build: 
3
+ @astrojs/markdown-remark:build: > @astrojs/markdown-remark@0.11.7 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,26 @@
1
1
  # @astrojs/markdown-remark
2
2
 
3
+ ## 0.11.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3919](https://github.com/withastro/astro/pull/3919) [`01a55467d`](https://github.com/withastro/astro/commit/01a55467d561974f843a9e0cd6963af7c840abb9) Thanks [@FredKSchott](https://github.com/FredKSchott)! - Add back missing ssr-utils.js file
8
+
9
+ ## 0.11.6
10
+
11
+ ### Patch Changes
12
+
13
+ - [#3911](https://github.com/withastro/astro/pull/3911) [`ca45c0c27`](https://github.com/withastro/astro/commit/ca45c0c270f5ca3f7d2fb113a235d415cecdb333) Thanks [@JuanM04](https://github.com/JuanM04)! - Don't throw when Shiki doesn't recognize a language
14
+
15
+ - Updated dependencies [[`b48767985`](https://github.com/withastro/astro/commit/b48767985359bd359df8071324952ea5f2bc0d86)]:
16
+ - @astrojs/prism@0.6.0
17
+
18
+ ## 0.11.5
19
+
20
+ ### Patch Changes
21
+
22
+ - [#3669](https://github.com/withastro/astro/pull/3669) [`93e1020b1`](https://github.com/withastro/astro/commit/93e1020b1e8549b08cf5646e1ebc3ae34e14ebc8) Thanks [@natemoo-re](https://github.com/natemoo-re)! - Tooling: reintroduce smoke test across example projects
23
+
3
24
  ## 0.11.4
4
25
 
5
26
  ### Patch Changes
@@ -14,7 +14,19 @@ const remarkShiki = async ({ langs = [], theme = "github-dark", wrap = false },
14
14
  }
15
15
  return () => (tree) => {
16
16
  visit(tree, "code", (node) => {
17
- let html = highlighter.codeToHtml(node.value, { lang: node.lang ?? "plaintext" });
17
+ let lang;
18
+ if (typeof node.lang === "string") {
19
+ const langExists = highlighter.getLoadedLanguages().includes(node.lang);
20
+ if (langExists) {
21
+ lang = node.lang;
22
+ } else {
23
+ console.warn(`The language "${node.lang}" doesn't exist, falling back to plaintext.`);
24
+ lang = "plaintext";
25
+ }
26
+ } else {
27
+ lang = "plaintext";
28
+ }
29
+ let html = highlighter.codeToHtml(node.value, { lang });
18
30
  html = html.replace('<pre class="shiki"', `<pre is:raw class="astro-code${scopedClassName ? " " + scopedClassName : ""}"`);
19
31
  html = html.replace(/style="(background-)?color: var\(--shiki-/g, 'style="$1color: var(--astro-code-');
20
32
  if (node.lang === "diff") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/markdown-remark",
3
- "version": "0.11.4",
3
+ "version": "0.11.7",
4
4
  "type": "module",
5
5
  "author": "withastro",
6
6
  "license": "MIT",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@astrojs/micromark-extension-mdx-jsx": "^1.0.3",
21
- "@astrojs/prism": "^0.5.0",
21
+ "@astrojs/prism": "^0.6.0",
22
22
  "acorn": "^8.7.1",
23
23
  "acorn-jsx": "^5.3.2",
24
24
  "assert": "^2.0.0",
@@ -30,7 +30,21 @@ const remarkShiki = async (
30
30
 
31
31
  return () => (tree: any) => {
32
32
  visit(tree, 'code', (node) => {
33
- let html = highlighter!.codeToHtml(node.value, { lang: node.lang ?? 'plaintext' });
33
+ let lang: string;
34
+
35
+ if (typeof node.lang === 'string') {
36
+ const langExists = highlighter.getLoadedLanguages().includes(node.lang);
37
+ if (langExists) {
38
+ lang = node.lang;
39
+ } else {
40
+ console.warn(`The language "${node.lang}" doesn't exist, falling back to plaintext.`);
41
+ lang = 'plaintext';
42
+ }
43
+ } else {
44
+ lang = 'plaintext';
45
+ }
46
+
47
+ let html = highlighter!.codeToHtml(node.value, { lang });
34
48
 
35
49
  // Q: Couldn't these regexes match on a user's inputted code blocks?
36
50
  // A: Nope! All rendered HTML is properly escaped.