-
Notifications
You must be signed in to change notification settings - Fork 169
Upgrade-to-rspress-v2 #3765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Upgrade-to-rspress-v2 #3765
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9f86e18
upgrade to rspress v2
samuelstroschein 65d2f15
add webpack ignore hints for dynamic inline plugin imports
samuelstroschein 080e7f7
add markdown copy button
samuelstroschein 608a534
add sitemap plugin and update documentation for clarity
samuelstroschein 593cda1
remvove lix sites
samuelstroschein 02b54db
initialize mermaid only once and update rendering logic
samuelstroschein f9c138a
refactor: improve mermaid initialization logic and rendering flow
samuelstroschein File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@lix-js/sdk": patch | ||
| --- | ||
|
|
||
| Add webpack/rspack ignore hints to dynamic inline plugin imports and document usage with a JSDoc example. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| import path from "node:path"; | ||
| import { visit } from "unist-util-visit"; | ||
| import type { Code, Parent } from "mdast"; | ||
| import type { RspressPlugin } from "@rspress/core"; | ||
|
|
||
| type MdxJsxFlowElement = { | ||
| type: "mdxJsxFlowElement"; | ||
| name: string; | ||
| attributes: Array<{ | ||
| type: "mdxJsxAttribute"; | ||
| name: string; | ||
| value: string; | ||
| }>; | ||
| children: []; | ||
| data?: Record<string, unknown>; | ||
| }; | ||
|
|
||
| export const mermaidComponentPath = path.join( | ||
| __dirname, | ||
| "../src/docs/components/Mermaid.tsx", | ||
| ); | ||
|
|
||
| /** | ||
| * Remark plugin that converts mermaid code fences into MDX components. | ||
| * | ||
| * @example | ||
| * remarkMermaid(); | ||
| */ | ||
| export const remarkMermaid = () => (tree: unknown) => { | ||
| visit(tree, "code", (node: Code, index, parent) => { | ||
| if ( | ||
| node.lang !== "mermaid" || | ||
| parent === null || | ||
| parent === undefined || | ||
| typeof index !== "number" | ||
| ) { | ||
| return; | ||
| } | ||
|
|
||
| const mermaidNode: MdxJsxFlowElement = { | ||
| type: "mdxJsxFlowElement", | ||
| name: "Mermaid", | ||
| attributes: [ | ||
| { | ||
| type: "mdxJsxAttribute", | ||
| name: "code", | ||
| value: node.value, | ||
| }, | ||
| ], | ||
| children: [], | ||
| data: { | ||
| _mdxExplicitJsx: true, | ||
| }, | ||
| }; | ||
|
|
||
| (parent as Parent).children.splice(index, 1, mermaidNode); | ||
| }); | ||
| }; | ||
|
|
||
| /** | ||
| * Transforms ```mermaid code fences into a Mermaid React component so diagrams render at runtime. | ||
| * | ||
| * @example | ||
| * mermaidPlugin(); | ||
| */ | ||
| export function mermaidPlugin(): RspressPlugin { | ||
| return { | ||
| name: "local-mermaid", | ||
| markdown: { | ||
| globalComponents: [mermaidComponentPath], | ||
| remarkPlugins: [remarkMermaid], | ||
| }, | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import { useEffect, useId, useState } from "react"; | ||
| import mermaid, { type MermaidConfig } from "mermaid"; | ||
|
|
||
| interface MermaidProps { | ||
| code: string; | ||
| config?: MermaidConfig; | ||
| } | ||
|
|
||
| /** | ||
| * Renders a Mermaid diagram from fenced code blocks. | ||
| * | ||
| * @example | ||
| * <Mermaid code="graph TD; A-->B;" /> | ||
| */ | ||
| export default function Mermaid({ code, config }: MermaidProps) { | ||
| const [svg, setSvg] = useState(""); | ||
| const [hasError, setHasError] = useState(false); | ||
| const id = useId().replace(/:/g, ""); | ||
|
|
||
| useEffect(() => { | ||
| const theme = document.documentElement.classList.contains("dark") | ||
| ? "dark" | ||
| : "default"; | ||
|
|
||
| const mergedConfig: MermaidConfig = { | ||
| startOnLoad: false, | ||
| securityLevel: "loose", | ||
| theme, | ||
| ...config, | ||
| }; | ||
|
|
||
| Promise.resolve() | ||
| .then(() => { | ||
| mermaid.initialize(mergedConfig); | ||
| return mermaid.render(id, code); | ||
| }) | ||
| .then(({ svg }) => { | ||
| setSvg(svg); | ||
| setHasError(false); | ||
| }) | ||
| .catch(() => setHasError(true)); | ||
| }, [code, config, id]); | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
samuelstroschein marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if (hasError) { | ||
| return null; | ||
| } | ||
|
|
||
| return <div dangerouslySetInnerHTML={{ __html: svg }} />; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,19 @@ | ||
| # What is Lix? | ||
|
|
||
| Lix is a JavaScript SDK for change control that enables Git-like capabilities for apps and agents: [Change proposals](/docs/change-proposals), [versions](/docs/versions) (branching), [history](/docs/history), [blame](/docs/attribution), and more. | ||
| Lix is a change control system that enables Git-like features for applications and AI agents such as [Change Proposals](/docs/change-proposals), [Versions](/docs/versions) (branching), [History](/docs/history), and [Blame](/docs/attribution). | ||
|
|
||
| What makes lix unique: | ||
|
|
||
| - 🌐 Embeddable - Works is in the Browser, Node.js, etc. | ||
| - 📄 Supports any data format (Excel, JSON, CSV, etc.) | ||
| - 🛠️ SDK-first - Provides a SQL API to query changes, history, etc. | ||
| - 🛠️ SDK-first - Designed for applications | ||
|
|
||
| ## Features | ||
| ## Use Cases | ||
|
|
||
| - [History](/docs/history) - Query the complete history of any entity | ||
| - [Diffs](/docs/diffs) - Compare changes across time and versions | ||
| - [Change Proposals](/docs/change-proposals) - Submit and review changes before applying | ||
| - [Conversations](/docs/conversations) - Discuss changes with your team | ||
| - [Restore](/docs/restore) - Restore previous states and undo changes | ||
| - AI agent safety rails: agents propose edits instead of applying directly; humans review diffs and restore if needed. | ||
| - Collaborative editing in apps: multi-user workflows with change proposals, conversations, and history/blame for structured data. | ||
| - Approval workflows: branch/merge-style reviews for non-code data before changes go live. | ||
| - Auditable data changes: track who changed what and when with versioned history and diff views. | ||
| - Product experiments and variants: spin up versions of data models or content, compare diffs, and merge back selectively. | ||
|
|
||
|  |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.