-
-
Notifications
You must be signed in to change notification settings - Fork 66
Add WASM bindings using wasm-bindgen #185
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
base: main
Are you sure you want to change the base?
Conversation
- Add wasm-bindgen setup with Cargo.toml - Implement to_html and to_html_with_options APIs - Support CommonMark, GFM, MDX, and frontmatter
- Create async/sync JavaScript API wrapper - Configure package.json with .mjs build script - Handle WASM initialization and module loading
- Test basic markdown conversions - Test GFM, MDX, and security options - Test sync/async APIs - Cover edge cases and complex markdown
- Add comprehensive README with API documentation - Add basic usage example - Add advanced options example - Include MIT LICENSE file
- Add wasm to Cargo workspace - Setup pnpm workspace with wasm directory - Add root package.json for development scripts - Update .gitignore for WASM build artifacts
Thanks for working on this! |
- Scope package as @wooorm/markdown-wasm - Export lib/index.mjs (+ types) - Add examples script and require Node >=18 - Update Whitelist files Refs: wooorm#185
I’m not fully confident in this change. |
I haven't had a chance to pull down the code and try it out (traveling presently). |
- Add @wooorm/markdown-wasm - Update wasm/README.md with correct package name - Fix installation and import examples to use @wooorm/markdown-wasm
Overview
Provides minimal WebAssembly bindings for markdown-rs, addressing the WASM hanging issues mentioned in #182 while following maintainer preference for WASM-only approach (no NAPI).
Background
This PR takes a different approach from #182
Key Improvements
npm
package using napi-rs #182.mjs
extension for proper Node.js module resolutionImplementation
Why Pure WASM?
Per maintainer feedback on #182:
Testing
Performance
While NAPI may be faster, WASM provides:
This approach prioritizes maintainability and reliability over maximum performance, aligning with project goals.
Related to #182