@astrojs/markdown-remark 0.6.1-next.1 → 0.6.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @astrojs/markdown-remark
2
2
 
3
+ ## 0.6.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2628](https://github.com/withastro/astro/pull/2628) [`9b7e2ab2`](https://github.com/withastro/astro/commit/9b7e2ab2516cd36520364490df8e3482008292e3) Thanks [@JuanM04](https://github.com/JuanM04)! - Fixed shiki to work with `{ "type": "module" }`
8
+
9
+ ## 0.6.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#2534](https://github.com/withastro/astro/pull/2534) [`cfeaa941`](https://github.com/withastro/astro/commit/cfeaa9414acdecec6f5d66ee0e33fe4fde574eee) Thanks [@JuanM04](https://github.com/JuanM04)! - Now you can use local plugins by passing a function instead of an `import`
14
+
15
+ * [#2518](https://github.com/withastro/astro/pull/2518) [`2bc91543`](https://github.com/withastro/astro/commit/2bc91543ceeb5f3dd45e201bf75d79f186e85141) Thanks [@JuanM04](https://github.com/JuanM04)! - Added the ability to use custom themes and langs with Shiki (`<Code />` and `@astrojs/markdown-remark`)
16
+
17
+ - [#2497](https://github.com/withastro/astro/pull/2497) [`6fe1b027`](https://github.com/withastro/astro/commit/6fe1b0279fce5a7a0e90ff79746ea0b641da3e21) Thanks [@JuanM04](https://github.com/JuanM04)! - Add Shiki as an alternative to Prism
18
+
19
+ * [#2518](https://github.com/withastro/astro/pull/2518) [`2bc91543`](https://github.com/withastro/astro/commit/2bc91543ceeb5f3dd45e201bf75d79f186e85141) Thanks [@JuanM04](https://github.com/JuanM04)! - Added `wrap` to Shiki config
20
+
21
+ - [#2564](https://github.com/withastro/astro/pull/2564) [`d71c4620`](https://github.com/withastro/astro/commit/d71c46207af40de6811596ca4f5e10aa9006377b) Thanks [@JuanM04](https://github.com/JuanM04)! - Fixed curly braces inside Shiki codeblocks
22
+
23
+ ## 0.6.1-next.2
24
+
25
+ ### Patch Changes
26
+
27
+ - [#2564](https://github.com/withastro/astro/pull/2564) [`d71c4620`](https://github.com/withastro/astro/commit/d71c46207af40de6811596ca4f5e10aa9006377b) Thanks [@JuanM04](https://github.com/JuanM04)! - Fixed curly braces inside Shiki codeblocks
28
+
3
29
  ## 0.6.1-next.1
4
30
 
5
31
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import shiki from 'shiki';
1
+ import type * as shiki from 'shiki';
2
2
  export interface ShikiConfig {
3
3
  /**
4
4
  * The languages loaded to Shiki.
@@ -1,7 +1,7 @@
1
- import shiki from "shiki";
1
+ import { getHighlighter } from "shiki";
2
2
  import { visit } from "unist-util-visit";
3
3
  const remarkShiki = async ({ langs = [], theme = "github-dark", wrap = false }) => {
4
- const highlighter = await shiki.getHighlighter({ theme });
4
+ const highlighter = await getHighlighter({ theme });
5
5
  for (const lang of langs) {
6
6
  await highlighter.loadLanguage(lang);
7
7
  }
@@ -9,7 +9,7 @@ const remarkShiki = async ({ langs = [], theme = "github-dark", wrap = false })
9
9
  visit(tree, "code", (node) => {
10
10
  var _a;
11
11
  let html = highlighter.codeToHtml(node.value, { lang: (_a = node.lang) != null ? _a : "plaintext" });
12
- html = html.replace('<pre class="shiki"', '<pre class="astro-code"');
12
+ html = html.replace('<pre class="shiki"', '<pre data-astro-raw class="astro-code"');
13
13
  html = html.replace(/style="(background-)?color: var\(--shiki-/g, 'style="$1color: var(--astro-code-');
14
14
  if (wrap === false) {
15
15
  html = html.replace(/style="(.*?)"/, 'style="$1; overflow-x: auto;"');
@@ -26,4 +26,4 @@ var remark_shiki_default = remarkShiki;
26
26
  export {
27
27
  remark_shiki_default as default
28
28
  };
29
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL3JlbWFyay1zaGlraS50cyJdLAogICJtYXBwaW5ncyI6ICJBQUFBO0FBQ0E7QU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QUFNLE1BQU0sUUFBUSxDQUFDLFNBQVM7QUF4Q2hDO0FBeUNHLFVBQUksT0FBTyxZQUFZLFdBQVcsS0FBSyxPQUFPLEVBQUUsTUFBTSxXQUFLLFNBQUwsWUFBYTtBQUduRSxhQUFPLEtBQUssUUFBUSxzQkFBc0I7QUFFMUMsYUFBTyxLQUFLLFFBQVEsOENBQThDO0FBR2xFLFVBQUksU0FBUyxPQUFPO0FBQ25CLGVBQU8sS0FBSyxRQUFRLGlCQUFpQjtBQUFBLGlCQUMzQixTQUFTLE1BQU07QUFDekIsZUFBTyxLQUFLLFFBQVEsaUJBQWlCO0FBQUE7QUFHdEMsV0FBSyxPQUFPO0FBQ1osV0FBSyxRQUFRO0FBQ2IsV0FBSyxXQUFXO0FBQUE7QUFBQTtBQUFBO0FBS25CLElBQU8sdUJBQVE7IiwKICAibmFtZXMiOiBbXQp9Cg==
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/markdown-remark",
3
- "version": "0.6.1-next.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "author": "withastro",
6
6
  "license": "MIT",
@@ -1,4 +1,5 @@
1
- import shiki from 'shiki';
1
+ import type * as shiki from 'shiki';
2
+ import { getHighlighter } from 'shiki';
2
3
  import { visit } from 'unist-util-visit';
3
4
 
4
5
  export interface ShikiConfig {
@@ -30,7 +31,7 @@ export interface ShikiConfig {
30
31
  }
31
32
 
32
33
  const remarkShiki = async ({ langs = [], theme = 'github-dark', wrap = false }: ShikiConfig) => {
33
- const highlighter = await shiki.getHighlighter({ theme });
34
+ const highlighter = await getHighlighter({ theme });
34
35
 
35
36
  for (const lang of langs) {
36
37
  await highlighter.loadLanguage(lang);
@@ -40,8 +41,8 @@ const remarkShiki = async ({ langs = [], theme = 'github-dark', wrap = false }:
40
41
  visit(tree, 'code', (node) => {
41
42
  let html = highlighter.codeToHtml(node.value, { lang: node.lang ?? 'plaintext' });
42
43
 
43
- // Replace "shiki" class naming with "astro".
44
- html = html.replace('<pre class="shiki"', '<pre class="astro-code"');
44
+ // Replace "shiki" class naming with "astro" and add "data-astro-raw".
45
+ html = html.replace('<pre class="shiki"', '<pre data-astro-raw class="astro-code"');
45
46
  // Replace "shiki" css variable naming with "astro".
46
47
  html = html.replace(/style="(background-)?color: var\(--shiki-/g, 'style="$1color: var(--astro-code-');
47
48
  // Handle code wrapping