Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .github/workflows/biome-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
toolchain: stable
- name: Check Rust code
Expand All @@ -27,14 +27,14 @@ jobs:
needs: check
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
toolchain: stable
- name: Cache wasm-pack
id: cache-wasm-pack
uses: actions/cache@v4
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/.cargo/bin/wasm-pack
key: wasm-pack-${{ runner.os }}
Expand All @@ -44,10 +44,14 @@ jobs:
- name: Build Rust project
run: cd markdown-renderer && wasm-pack build --target web --release --features sanitize
- name: Set up Bun.js
uses: oven-sh/setup-bun@v2
uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2.0.1
with:
bun-version: latest
- name: Post-process wasm package
run: bun process_wasm_pkg.js
- name: Install Dependencies
run: bun install
- name: Build React example
run: bun run example-react:build
- name: Run Biome Check
run: bun run check
2 changes: 2 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
run: bun install
- name: Build library
run: bun run build
- name: Build React example
run: bun run example-react:build
- name: Upload artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,17 @@
- [Haxiom](https://haxiom.io)
- Using this project and want your company/project here? Feel free to open a PR!

## Example
## Examples

You can visit [live-preview.inve.rs](https://live-preview.inve.rs "live-preview") to see the [example](./example) folder deployed. It uses [solid-monaco](https://github.com/alxnddr/solid-monaco "solid-monaco") + [tailwind](https://tailwindcss.com/ "tailwindcss") + [solidjs](https://www.solidjs.com/ "solidjs") and this library to showcase what is possible.
- **SolidJS example (`./example`)**: Visit [live-preview.inve.rs](https://live-preview.inve.rs "live-preview") to see the deployed SolidJS demo. It uses [solid-monaco](https://github.com/alxnddr/solid-monaco "solid-monaco") + [tailwind](https://tailwindcss.com/ "tailwindcss") + [solidjs](https://www.solidjs.com/ "solidjs").
- **React example (`./example-react`)**: A React + Monaco demo showcasing the same WASM markdown renderer APIs in a React app.

Run them locally from the repository root:

```bash
bun run example:dev
bun run example-react:dev
```

## Installation

Expand Down
Binary file modified bun.lockb
Binary file not shown.
15 changes: 15 additions & 0 deletions example-react/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<link rel="icon" type="image/svg+xml" href="/src/assets/haxiom.svg" />
<title>solid-markdown-wasm raw WASM React example</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
33 changes: 33 additions & 0 deletions example-react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "vite-template-react",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"start": "vite",
"dev": "vite",
"build": "vite build",
"serve": "vite preview"
},
"license": "MIT",
"dependencies": {
"@monaco-editor/react": "^4.7.0",
"@solid-markdown-wasm/example-shared": "file:../packages/example-shared",
"lucide-react": "^0.479.0",
"markdown-renderer": "file:../markdown-renderer/pkg/",
"mermaid": "^11.12.2",
"monaco-editor": "^0.48.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"tailwindcss": "^4.1.7"
},
"devDependencies": {
"@tailwindcss/vite": "^4.1.7",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@vitejs/plugin-react": "^4.4.1",
"typescript": "^5.8.3",
"vite": "^6.0.0",
"vite-plugin-wasm": "^3.5.0"
}
}
Loading
Loading