You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
Need to add tests that validate that the package can be built and used in a browser. Need to figure out if going webpack or non-weback (web target) and then set up a headless browser test via github actions.
Also, saving this non-webpack example as backup since it isn't checked in anywhere:
<html><head><metacontent="text/html;charset=utf-8" http-equiv="Content-Type"/></head><body><pre><codeid="vimwiki-snippet">
=== Header ===
This is a snippet of vimwiki that is displayed in a browser.
[[some link]]
[[diary:2021-05-18|My diary link]]
:my:tags:
</code></pre><hr/><divid="vimwiki-output"></div><!-- Note the usage of `type=module` here as this is an ES6 module --><scripttype="module">importinit,{parse_vimwiki_str}from'./vimwiki_wasm.js';asyncfunctionrun(){awaitinit();// Load the code snippetconstcode=document.getElementById("vimwiki-snippet");// Parse the code into an objectconstobj=parse_vimwiki_str(code.innerText);// Find regions in code that contain headers and highlight them by// transforming that text into spans with colorsconstregions=obj.find_all_header_regions();Object.values(regions).forEach(region=>{console.log(region);// Select the headerconstrange=newRange();range.setStart(code.firstChild,region.offset);range.setEnd(code.firstChild,region.len);// Build a colored versionconstcolored=document.createElement("span");colored.style.color="red";colored.innerText=range.toString();range.deleteContents();range.insertNode(colored);});// Inject HTML into output destinationconstoutput=document.getElementById("vimwiki-output");output.insertAdjacentHTML("afterbegin",obj.to_html_str());}run();</script></body></html>
The text was updated successfully, but these errors were encountered:
<html><head><metacontent="text/html;charset=utf-8" http-equiv="Content-Type"/></head><body><pre><codeid="vimwiki-snippet">
=== Header ===
This is a snippet of vimwiki that is displayed in a browser.
[[some link]]
[[diary:2021-05-18|My diary link]]
:my:tags:
</code></pre><hr/><divid="vimwiki-output"></div><!-- Note the usage of `type=module` here as this is an ES6 module --><scripttype="module">importinit,{parse_vimwiki_str}from'./vimwiki_wasm.js';asyncfunctionrun(){awaitinit();// Load the code snippetconstcode=document.getElementById("vimwiki-snippet");// Parse the code into an objectconstpage=parse_vimwiki_str(code.innerText);// Find regions in code that contain headers and highlight them by// transforming that text into spans with colorsconstregions=page.descendants.filter(e=>e.is_block()).map(e=>e.into_block()).filter(e=>e.is_header()).map(e=>e.into_header().region);Object.values(regions).forEach(region=>{console.log(region.to_debug_str());// Select the headerconstrange=newRange();range.setStart(code.firstChild,region.offset);range.setEnd(code.firstChild,region.len);// Build a colored versionconstcolored=document.createElement("span");colored.style.color="red";colored.innerText=range.toString();range.deleteContents();range.insertNode(colored);});// Inject HTML into output destinationconstoutput=document.getElementById("vimwiki-output");output.insertAdjacentHTML("afterbegin",page.to_html_str());}run();</script></body></html>
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Need to add tests that validate that the package can be built and used in a browser. Need to figure out if going webpack or non-weback (web target) and then set up a headless browser test via github actions.
See https://rustwasm.github.io/docs/wasm-bindgen/wasm-bindgen-test/browsers.html and https://rustwasm.github.io/docs/wasm-bindgen/wasm-bindgen-test/continuous-integration.html#github-actions
Also, saving this non-webpack example as backup since it isn't checked in anywhere:
The text was updated successfully, but these errors were encountered: