@astrojs/markdown-remark 0.11.5 → 0.12.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/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +26 -0
- package/dist/remark-shiki.js +13 -1
- package/package.json +2 -2
- package/src/remark-shiki.ts +16 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
1
|
+
[35m@astrojs/markdown-remark:build: [0mcache hit, replaying output [2m1546942a008a83f6[0m
|
|
2
|
+
[35m@astrojs/markdown-remark:build: [0m
|
|
3
|
+
[35m@astrojs/markdown-remark:build: [0m> @astrojs/markdown-remark@0.12.0 build /home/runner/work/astro/astro/packages/markdown/remark
|
|
4
|
+
[35m@astrojs/markdown-remark:build: [0m> astro-scripts build "src/**/*.ts" && tsc -p tsconfig.json
|
|
5
|
+
[35m@astrojs/markdown-remark:build: [0m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @astrojs/markdown-remark
|
|
2
2
|
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#3924](https://github.com/withastro/astro/pull/3924) [`07fb544da`](https://github.com/withastro/astro/commit/07fb544dab142a3d4bb9d0d878aab34eaea447b2) Thanks [@FredKSchott](https://github.com/FredKSchott)! - Remove unused ssr-utils file
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`31f9c0bf0`](https://github.com/withastro/astro/commit/31f9c0bf029ffa4b470e620f2c32e1370643e81e)]:
|
|
12
|
+
- @astrojs/prism@0.6.1
|
|
13
|
+
|
|
14
|
+
## 0.11.7
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [#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
|
|
19
|
+
|
|
20
|
+
## 0.11.6
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [#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
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [[`b48767985`](https://github.com/withastro/astro/commit/b48767985359bd359df8071324952ea5f2bc0d86)]:
|
|
27
|
+
- @astrojs/prism@0.6.0
|
|
28
|
+
|
|
3
29
|
## 0.11.5
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/remark-shiki.js
CHANGED
|
@@ -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
|
|
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.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "withastro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@astrojs/micromark-extension-mdx-jsx": "^1.0.3",
|
|
20
|
-
"@astrojs/prism": "^0.
|
|
20
|
+
"@astrojs/prism": "^0.6.1",
|
|
21
21
|
"acorn": "^8.7.1",
|
|
22
22
|
"acorn-jsx": "^5.3.2",
|
|
23
23
|
"assert": "^2.0.0",
|
package/src/remark-shiki.ts
CHANGED
|
@@ -30,7 +30,22 @@ const remarkShiki = async (
|
|
|
30
30
|
|
|
31
31
|
return () => (tree: any) => {
|
|
32
32
|
visit(tree, 'code', (node) => {
|
|
33
|
-
let
|
|
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
|
+
// eslint-disable-next-line no-console
|
|
41
|
+
console.warn(`The language "${node.lang}" doesn't exist, falling back to plaintext.`);
|
|
42
|
+
lang = 'plaintext';
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
lang = 'plaintext';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let html = highlighter!.codeToHtml(node.value, { lang });
|
|
34
49
|
|
|
35
50
|
// Q: Couldn't these regexes match on a user's inputted code blocks?
|
|
36
51
|
// A: Nope! All rendered HTML is properly escaped.
|