@astrojs/markdown-remark 1.1.0 → 1.1.1

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 2767636b7aea5828
1
+ @astrojs/markdown-remark:build: cache hit, replaying output ddf2e92d592039b4
2
2
  @astrojs/markdown-remark:build: 
3
- @astrojs/markdown-remark:build: > @astrojs/markdown-remark@1.1.0 build /home/runner/work/astro/astro/packages/markdown/remark
3
+ @astrojs/markdown-remark:build: > @astrojs/markdown-remark@1.1.1 build /home/runner/work/astro/astro/packages/markdown/remark
4
4
  @astrojs/markdown-remark:build: > astro-scripts build "src/**/*.ts" && tsc -p tsconfig.json
5
5
  @astrojs/markdown-remark:build: 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @astrojs/markdown-remark
2
2
 
3
+ ## 1.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#4519](https://github.com/withastro/astro/pull/4519) [`a2e8e76c3`](https://github.com/withastro/astro/commit/a2e8e76c303e8d6f39c24c122905a10f06907997) Thanks [@JuanM04](https://github.com/JuanM04)! - Upgraded Shiki to v0.11.1
8
+
3
9
  ## 1.1.0
4
10
 
5
11
  ### Minor Changes
@@ -5,7 +5,22 @@ const remarkShiki = async ({ langs = [], theme = "github-dark", wrap = false },
5
5
  const cacheID = typeof theme === "string" ? theme : theme.name;
6
6
  let highlighterAsync = highlighterCacheAsync.get(cacheID);
7
7
  if (!highlighterAsync) {
8
- highlighterAsync = getHighlighter({ theme });
8
+ highlighterAsync = getHighlighter({ theme }).then((hl) => {
9
+ hl.setColorReplacements({
10
+ "#000001": "var(--astro-code-color-text)",
11
+ "#000002": "var(--astro-code-color-background)",
12
+ "#000004": "var(--astro-code-token-constant)",
13
+ "#000005": "var(--astro-code-token-string)",
14
+ "#000006": "var(--astro-code-token-comment)",
15
+ "#000007": "var(--astro-code-token-keyword)",
16
+ "#000008": "var(--astro-code-token-parameter)",
17
+ "#000009": "var(--astro-code-token-function)",
18
+ "#000010": "var(--astro-code-token-string-expression)",
19
+ "#000011": "var(--astro-code-token-punctuation)",
20
+ "#000012": "var(--astro-code-token-link)"
21
+ });
22
+ return hl;
23
+ });
9
24
  highlighterCacheAsync.set(cacheID, highlighterAsync);
10
25
  }
11
26
  const highlighter = await highlighterAsync;
@@ -31,10 +46,6 @@ const remarkShiki = async ({ langs = [], theme = "github-dark", wrap = false },
31
46
  '<pre class="shiki"',
32
47
  `<pre is:raw class="astro-code${scopedClassName ? " " + scopedClassName : ""}"`
33
48
  );
34
- html = html.replace(
35
- /style="(background-)?color: var\(--shiki-/g,
36
- 'style="$1color: var(--astro-code-'
37
- );
38
49
  if (node.lang === "diff") {
39
50
  html = html.replace(
40
51
  /<span class="line"><span style="(.*?)">([\+|\-])/g,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/markdown-remark",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "author": "withastro",
6
6
  "license": "MIT",
@@ -32,7 +32,7 @@
32
32
  "remark-parse": "^10.0.1",
33
33
  "remark-rehype": "^10.1.0",
34
34
  "remark-smartypants": "^2.0.0",
35
- "shiki": "^0.10.1",
35
+ "shiki": "^0.11.1",
36
36
  "unified": "^10.1.2",
37
37
  "unist-util-map": "^3.1.1",
38
38
  "unist-util-visit": "^4.1.0",
@@ -17,7 +17,22 @@ const remarkShiki = async (
17
17
  const cacheID: string = typeof theme === 'string' ? theme : theme.name;
18
18
  let highlighterAsync = highlighterCacheAsync.get(cacheID);
19
19
  if (!highlighterAsync) {
20
- highlighterAsync = getHighlighter({ theme });
20
+ highlighterAsync = getHighlighter({ theme }).then((hl) => {
21
+ hl.setColorReplacements({
22
+ '#000001': 'var(--astro-code-color-text)',
23
+ '#000002': 'var(--astro-code-color-background)',
24
+ '#000004': 'var(--astro-code-token-constant)',
25
+ '#000005': 'var(--astro-code-token-string)',
26
+ '#000006': 'var(--astro-code-token-comment)',
27
+ '#000007': 'var(--astro-code-token-keyword)',
28
+ '#000008': 'var(--astro-code-token-parameter)',
29
+ '#000009': 'var(--astro-code-token-function)',
30
+ '#000010': 'var(--astro-code-token-string-expression)',
31
+ '#000011': 'var(--astro-code-token-punctuation)',
32
+ '#000012': 'var(--astro-code-token-link)',
33
+ });
34
+ return hl;
35
+ });
21
36
  highlighterCacheAsync.set(cacheID, highlighterAsync);
22
37
  }
23
38
  const highlighter = await highlighterAsync;
@@ -58,11 +73,6 @@ const remarkShiki = async (
58
73
  '<pre class="shiki"',
59
74
  `<pre is:raw class="astro-code${scopedClassName ? ' ' + scopedClassName : ''}"`
60
75
  );
61
- // Replace "shiki" css variable naming with "astro".
62
- html = html.replace(
63
- /style="(background-)?color: var\(--shiki-/g,
64
- 'style="$1color: var(--astro-code-'
65
- );
66
76
  // Add "user-select: none;" for "+"/"-" diff symbols
67
77
  if (node.lang === 'diff') {
68
78
  html = html.replace(