Skip to content

SDK Markdown Editor example is severely outdated. #164

Description

@Brogolem35

Doc in question: https://docs.wasmer.io/sdk/wasmer-js/tutorials/run/

Rust example does not compile, but it is possible to still build them with these changes:

  • pulldown_cmark::html::write_html function is renamed to pulldown_cmark::html::write_html_io.
  • Target wasm32-wasi is removed from rustup and wasm32-wasip1 is used instead.

While these changes fix the compiling on the Rust side, the resulting binary doesn't work on the browser with the provided JS code while working fine on Wasmer CLI. The given error is emitted by the browser:

panicked at src/tasks/task_wasm.rs:38:43:
called `Result::unwrap()` on an `Err` value: Generic("Not able to serialize module")

I unfortunatelly could not find a workaround for this one.

package.json:

{
  "name": "markdown_wasm",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "vite",
    "build": "vite build"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "type": "commonjs",
  "dependencies": {
    "@wasmer/sdk": "^0.10.0"
  },
  "devDependencies": {
    "vite": "^8.0.10"
  }
}

Cargo.toml:

[package]
name = "markdown-renderer"
version = "0.1.0"
edition = "2024"

[dependencies]
pulldown-cmark = "0.13.3"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions