@humanspeak/svelte-markdown 1.1.0 → 1.2.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.
@@ -97,14 +97,16 @@
97
97
 
98
98
  // Streaming mode: full re-parse + smart in-place diff
99
99
  let incrementalParser: IncrementalParser | undefined
100
- let lastOptionsKey = ''
100
+ let lastOptionsSrc: typeof options | undefined
101
+ let lastExtensionsSrc: typeof extensions | undefined
101
102
  let streamTokens = $state<Token[]>([])
102
103
 
103
104
  $effect(() => {
104
105
  if (!streaming || hasAsyncExtension) {
105
106
  if (incrementalParser) {
106
107
  incrementalParser = undefined
107
- lastOptionsKey = ''
108
+ lastOptionsSrc = undefined
109
+ lastExtensionsSrc = undefined
108
110
  }
109
111
  if (streaming && hasAsyncExtension) {
110
112
  console.warn(
@@ -115,9 +117,8 @@
115
117
  return
116
118
  }
117
119
 
118
- // Read combinedOptions unconditionally so Svelte tracks it as a dependency
120
+ // Read combinedOptions so Svelte tracks it as a dependency
119
121
  const currentOptions = combinedOptions
120
- const optionsKey = JSON.stringify(currentOptions)
121
122
 
122
123
  if (Array.isArray(source)) {
123
124
  streamTokens = source as Token[]
@@ -130,10 +131,11 @@
130
131
  return
131
132
  }
132
133
 
133
- // Recreate parser only when options actually change
134
- if (!incrementalParser || lastOptionsKey !== optionsKey) {
134
+ // Recreate parser when user-facing options or extensions change
135
+ if (!incrementalParser || lastOptionsSrc !== options || lastExtensionsSrc !== extensions) {
135
136
  incrementalParser = new IncrementalParser(currentOptions)
136
- lastOptionsKey = optionsKey
137
+ lastOptionsSrc = options
138
+ lastExtensionsSrc = extensions
137
139
  }
138
140
  const { tokens: newTokens, divergeAt } = incrementalParser.update(source as string)
139
141
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humanspeak/svelte-markdown",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Fast, customizable markdown renderer for Svelte with built-in caching, TypeScript support, and Svelte 5 runes",
5
5
  "keywords": [
6
6
  "svelte",