chipsenkbeil / vimwiki-rs

Rust library and tooling to parse, render, and modify vimwiki text and files.
56 stars 2 forks source link

Support publishing vimwiki crate for web assembly #104

Closed chipsenkbeil closed 3 years ago

chipsenkbeil commented 3 years ago

This way, browsers could parse vimwiki within a page to provide syntax highlighting and other details.

Assuming macros feature would not be supported. HTML feature may also not be supported.

chipsenkbeil commented 3 years ago

Did a quick proof of concept and this works, although not without problems. I can parse and export a JavaScript object, but not my actual object because of the lifetime being required in the function. See https://github.com/rustwasm/wasm-bindgen/issues/1187.

Screen Shot 2021-05-18 at 12 02 57 AM
chipsenkbeil commented 3 years ago

Am able to apply syntax highlighting by providing a wasm function to return regions of headers (as js objects):

Screen Shot 2021-05-18 at 1 08 55 AM Screen Shot 2021-05-18 at 1 09 28 AM
chipsenkbeil commented 3 years ago

Closing this out as it's now part of my active branch to introduce HTML support. The wasm API needs to be fleshed out, but that can be a separate issue.