|
| 1 | +# `pandoc-wasm` |
| 2 | + |
| 3 | +[](https://matrix.to/#/#haskell-wasm:matrix.terrorjack.com) |
| 4 | + |
| 5 | +The latest version of `pandoc` CLI compiled as a standalone |
| 6 | +`wasm32-wasi` module that can be run by engines like `wasmtime` as |
| 7 | +well as browsers. |
| 8 | + |
| 9 | +## [Live demo](https://tweag.github.io/pandoc-wasm) |
| 10 | + |
| 11 | +Stdin on the left, stdout on the right, command line arguments at the |
| 12 | +bottom. No convert button, output is produced dynamically as input |
| 13 | +changes. |
| 14 | + |
| 15 | +You're also more than welcome to fetch the |
| 16 | +[`pandoc.wasm`](https://tweag.github.io/pandoc-wasm/pandoc.wasm) |
| 17 | +module and make your own customized app. `pandoc.wasm` is fully |
| 18 | +`wasm32-wasi` compliant and doesn't make use of any JSFFI feature in |
| 19 | +the ghc wasm backend. |
| 20 | + |
| 21 | +## Building |
| 22 | + |
| 23 | +`pandoc.wasm` is built with 9.12 flavour of ghc wasm backend in CI, |
| 24 | +which can be installed via |
| 25 | +[`ghc-wasm-meta`](https://gitlab.haskell.org/ghc/ghc-wasm-meta). You |
| 26 | +need at least 9.10 since it's the earliest major version with (my |
| 27 | +non-official) backports for ghc wasm backend's Template Haskell & ghci |
| 28 | +support. |
| 29 | + |
| 30 | +It's built using my |
| 31 | +[fork](https://github.com/TerrorJack/pandoc/tree/wasm) which is based |
| 32 | +on latest `pandoc` release and patches dependencies, cabal config as |
| 33 | +well as some module code to make things compilable to wasm: |
| 34 | + |
| 35 | +- No http client/server functionality. `wasip1` doesn't have proper |
| 36 | + sockets support anyway, and support for future versions of wasi is |
| 37 | + not on my radar for now. |
| 38 | +- No lua support. lua requires `setjmp`/`longjmp` which already work |
| 39 | + in `wasi-libc` to some extent, but that requires wasm exception |
| 40 | + handling feature which is not supported by `wasmtime` yet. |
| 41 | + |
| 42 | +Other functionalities should just work, if not feel free to file a bug |
| 43 | +report :) |
| 44 | + |
| 45 | +## Acknowledgements |
| 46 | + |
| 47 | +Thanks to John MacFarlane and all the contributors who made `pandoc` |
| 48 | +possible: a fantastic tool that has benefited many developers and is a |
| 49 | +source of pride for the Haskell community! |
| 50 | + |
| 51 | +Thanks to all past efforts of using `asterius` to compile `pandoc` to |
| 52 | +wasm, including but not limited to: |
| 53 | + |
| 54 | +- George Stagg's [`pandoc-wasm`](https://github.com/georgestagg/pandoc-wasm) |
| 55 | +- Yuto Takahashi's [`wasm-pandoc`](https://github.com/y-taka-23/wasm-pandoc) |
| 56 | +- My legacy asterius pandoc [demo](https://asterius.netlify.app/demo/pandoc/pandoc.html) |
0 commit comments