mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-17 08:03:06 +00:00
* feat: universal styled markdown code blocks with copy button and subtle scrollbar Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(sessions): use the shared DraggableTabs for the preview tab strip The session preview tabs were bespoke markup; converge them onto the same DraggableTabs component the raw-app editor uses, gaining drag-reorder and keyboard nav. The active tab keeps its breadcrumb/router picker via a new tabAccessory snippet, and tabs persist their new order. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(sessions): keep the new-tab + button right after the last tab Add an afterTabs snippet to DraggableTabs that renders inside the scroll row after the tabs (unlike trailing, which stays pinned outside it), and move the session preview "+" there so it sits next to the last tab. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(tabs): use the subtle ScrollableX scrollbar for Tabs/TabsV2 headers Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * style(sessions): use bg-surface for the preview tab strip Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * style(tabs): add subtle shadow-sm to the selected DraggableTabs tab Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * style(tabs): drop selected-tab shadow; session strip bg-surface-secondary/50 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * style(sessions): drop persistent bg on preview bar buttons, hover-only Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(scrollbar): share a .scrollbar-subtle utility across tabs and chat Extract ScrollableX's hover-revealed scrollbar styling into a global .scrollbar-subtle utility (both axes, size via --wm-scrollbar-size), have ScrollableX consume it, and apply it to the AI chat message list so the chat scrollbar matches the tabs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix: address review — scope HighlightCode copy button, plaintext unknown fences, Tailwind ScrollableX - HighlightCode: keep the subtle CopyButton + surface chip behind buttonsOnHover so the ~20 non-markdown callers keep the original light copy Button. - MarkdownCodeBlock: unlabeled/unknown fences render as plaintext instead of being mis-colored as TypeScript; added common language aliases (ts/js/py/...) so real languages still highlight. - ScrollableX: replace the custom <style> block with Tailwind overflow classes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * style: make chat and session-sidebar typing dots slightly smaller Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix: address auto-review — powershell fence to plaintext + reorder tests - MarkdownCodeBlock: drop 'powershell' from the sql group so it renders plaintext instead of SQL-colored (no powershell highlighter in the map). - sessionPreviewTabs.test.ts: cover reorder (reorders+persists, ignores unknown ids / keeps omitted at end, no-op when unchanged). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix: keep scrollbar-hidden on Tabs row as TroubleshootFlowTutorial selector hook codex-review: removing scrollbar-hidden broke the tutorial's '.border-b.flex .flex-row.whitespace-nowrap.scrollbar-hidden.mx-auto' selector. The class is inert on the non-scrolling row (ScrollableX owns the scroll) but is kept as the tutorial's stable hook. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix: preserve raw <pre> content in MarkdownCodeBlock (codex-review) As the universal pre renderer, MarkdownCodeBlock also handles sanitized raw HTML <pre>text</pre> from rehypeRaw, where the text is a direct child of <pre> (no <code>). Fall back to that text child so raw pre content isn't dropped to an empty block. Kitchen-sink sample gains a raw <pre> case. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
38 lines
1.8 KiB
TypeScript
38 lines
1.8 KiB
TypeScript
import type { Plugin } from 'svelte-exmarkdown'
|
|
import { gfmPlugin } from 'svelte-exmarkdown/gfm'
|
|
import rehypeRaw from 'rehype-raw'
|
|
import rehypeSanitize from 'rehype-sanitize'
|
|
import { rehypeGithubAlerts } from 'rehype-github-alerts'
|
|
import MarkdownCodeBlock from './MarkdownCodeBlock.svelte'
|
|
|
|
/**
|
|
* Shared plugin chain for rendering user-supplied Markdown (script/flow/resource
|
|
* descriptions, flow-graph notes, the App "Markdown" component, ...).
|
|
*
|
|
* Order matters and is security-sensitive:
|
|
* 1. `gfmPlugin` — GitHub-flavored Markdown.
|
|
* 2. `rehypeRaw` — re-parses embedded raw HTML into live hast nodes.
|
|
* 3. `rehypeSanitize` — strips dangerous nodes (`<script>`, `<iframe>`,
|
|
* `<svg><script>`, `on*` handlers, `javascript:` URLs)
|
|
* from the raw-parsed tree. Without this stage the raw
|
|
* HTML reaches the DOM and executes (stored XSS).
|
|
* 4. `rehypeGithubAlerts` — runs AFTER sanitize so the trusted alert markup it
|
|
* injects (including inline SVG icons) is preserved
|
|
* without having to allowlist SVG for user input.
|
|
*
|
|
* The `pre` renderer gives fenced code blocks syntax highlighting, a copy
|
|
* button, and a subtle scrollbar everywhere this chain is used. It reads the
|
|
* `language-*` class rehypeSanitize preserves on `<code>`; it highlights code as
|
|
* escaped text and never renders mermaid on untrusted input (chat opts in).
|
|
*
|
|
* Any Markdown sink that renders user input MUST use this chain rather than
|
|
* assembling its own `rehypeRaw` pipeline.
|
|
*/
|
|
export const markdownPlugins: Plugin[] = [
|
|
gfmPlugin(),
|
|
{ rehypePlugin: [rehypeRaw] },
|
|
{ rehypePlugin: [rehypeSanitize] },
|
|
{ rehypePlugin: [rehypeGithubAlerts] },
|
|
{ renderer: { pre: MarkdownCodeBlock } }
|
|
]
|