svelte-prism-action 1.1.0 → 1.1.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/README.md CHANGED
@@ -83,6 +83,14 @@ You can also change the IntersectionObserver options. For more information on wh
83
83
 
84
84
  ## Changelog
85
85
 
86
+ ### 1.1.2 (2023-03-16)
87
+
88
+ - Fix: highlight fails when `prism-markup.js` import not finished
89
+
90
+ ### 1.1.1 (2023-03-15)
91
+
92
+ - Fix: SvelteKit error while loading prism-markup.js
93
+
86
94
  ### 1.1.0 (2023-03-15)
87
95
 
88
96
  - Add: support for third party language files
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-prism-action",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Svelte action for lazy render code blocks with prism.js.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -6,7 +6,6 @@ if (typeof window !== "undefined") {
6
6
 
7
7
  import { tick } from "svelte";
8
8
  import Prism from "prismjs/components/prism-core";
9
- import "prismjs/components/prism-markup";
10
9
  import getLoader from "prismjs/dependencies";
11
10
  import { components } from "./components";
12
11
 
@@ -140,7 +139,10 @@ export function prism(node, params) {
140
139
  //wait for onMount on parent
141
140
  let observer;
142
141
 
143
- tick().then(() => {
142
+ tick().then(async () => {
143
+ //load markup component, is needed for all languages
144
+ await import(/* @vite-ignore */ "prismjs/components/prism-markup");
145
+
144
146
  //add observer to code blocks
145
147
  const codeblocks = node.querySelectorAll("code");
146
148
  observer = new IntersectionObserver(onIntersect, { ...options });