
Security News
PolinRider: North Korea-Linked Supply Chain Campaign Expands Across Open Source Ecosystems
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.
markstream-core
Advanced tools
Framework-agnostic smooth streaming controller and streaming text state utilities for Markstream
Framework-agnostic smooth streaming controller and streaming text state utilities for Markstream.
This package extracts the core pacing algorithm and streaming text resolution logic shared across all Markstream framework packages (Vue 3, Vue 2, React, Angular, Svelte).
npm install markstream-core
createSmoothMarkdownStreamFactory API for a framework-agnostic streaming controller with snapshot + subscribe semantics.
import { createSmoothMarkdownStream } from 'markstream-core'
const controller = createSmoothMarkdownStream({ minCharsPerSecond: 40, maxCharsPerSecond: 1000 })
const unsubscribe = controller.subscribe(() => {
const snapshot = controller.getSnapshot()
updateUI(snapshot.visible)
if (snapshot.final)
onStreamDone()
})
controller.enqueue(chunk)
controller.finish()
controller.flush()
controller.pause()
controller.resume()
controller.destroy()
controller.dispose() // alias of destroy()
unsubscribe()
SmoothMarkdownStreamController is the public controller interface type returned by createSmoothMarkdownStream.
SmoothMarkdownStreamOptions)| Option | Default | Description |
|---|---|---|
minCharsPerSecond | 40 | Minimum reveal speed |
maxCharsPerSecond | 1000 | Maximum reveal speed |
targetLatencyMs | 900 | Target latency for pacing calculation |
catchUpLatencyMs | 350 | Latency threshold for catch-up mode |
catchUpThreshold | 600 | Character backlog that triggers catch-up |
maxCommitFps | 30 | Maximum commits per second |
startDelayMs | 80 | Delay before first reveal |
maxCharsPerCommit | 80 | Maximum characters per animation frame |
flushOnFinish | false | Auto-flush when finish() is called |
resolveStreamingTextStateResolves the next streaming text state for simple append detection.
import { resolveStreamingTextState } from 'markstream-core'
const result = resolveStreamingTextState({
nextContent: 'hello world',
previousContent: 'hello',
typewriterEnabled: true,
})
// result = { settledContent: 'hello', streamedDelta: ' world', appended: true }
resolveStreamingTextUpdateExtended resolver that handles React StrictMode replay guards and stream version resets.
import { resolveStreamingTextUpdate } from 'markstream-core'
const result = resolveStreamingTextUpdate({
nextContent: 'hello world!',
currentState: { settledContent: 'hello', streamedDelta: ' world' },
typewriterEnabled: true,
})
useSmoothMarkdownStream in markstream-vue wraps the core controller with Vue reactivity.markstream-core internally.
Import core APIs directly from markstream-core when needed.MIT
FAQs
Framework-agnostic smooth streaming controller and streaming text state utilities for Markstream
We found that markstream-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.

Security News
Open source attacks are accelerating as AI coding agents pull in dependencies faster, with less human review.

Research
/Security News
Malicious Chrome and Firefox extensions posed as free VPNs while stealing clipboard data through later extension updates.