Skip to content

Commit 4a4d101

Browse files
[backport cloud/1.42] feat: expose renderMarkdownToHtml on ExtensionManager (#10720)
Backport of #10700 to `cloud/1.42` Automatically created by backport workflow. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-10720-backport-cloud-1-42-feat-expose-renderMarkdownToHtml-on-ExtensionManager-3326d73d3650819189fde93d1fe2584b) by [Unito](https://www.unito.io) Co-authored-by: Christian Byrne <cbyrne@comfy.org>
1 parent 18932a7 commit 4a4d101

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/stores/workspaceStore.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type { Settings } from '@/schemas/apiSchema'
99
import { useColorPaletteService } from '@/services/colorPaletteService'
1010
import { useDialogService } from '@/services/dialogService'
1111
import type { SidebarTabExtension, ToastManager } from '@/types/extensionTypes'
12+
import { renderMarkdownToHtml } from '@/utils/markdownRendererUtil'
1213

1314
import { useApiKeyAuthStore } from './apiKeyAuthStore'
1415
import { useCommandStore } from './commandStore'
@@ -113,7 +114,8 @@ function workspaceStoreSetup() {
113114

114115
registerSidebarTab,
115116
unregisterSidebarTab,
116-
getSidebarTabs
117+
getSidebarTabs,
118+
renderMarkdownToHtml
117119
}
118120
}
119121

src/types/extensionTypes.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ export interface ExtensionManager {
117117
// Execution error state (read-only)
118118
lastNodeErrors: Record<NodeId, NodeError> | null
119119
lastExecutionError: ExecutionErrorWsMessage | null
120+
121+
/**
122+
* Renders a markdown string to sanitized HTML.
123+
* Uses marked (GFM) + DOMPurify. Safe for direct use with innerHTML.
124+
* @param markdown - The markdown string to render.
125+
* @param baseUrl - Optional base URL for resolving relative image/media paths.
126+
*/
127+
renderMarkdownToHtml(markdown: string, baseUrl?: string): string
120128
}
121129

122130
export interface CommandManager {

0 commit comments

Comments
 (0)